@@ -42,14 +42,45 @@ namespace nil {
42
42
OutputIterator out) {
43
43
44
44
typedef typename BlockCipher::stream_encrypter_type EncryptionMode;
45
- typedef typename detail::itr_stream_encrypter_traits <EncryptionMode, InputIterator>::type CiperState ;
45
+ typedef typename block::block_accumulator <EncryptionMode> CipherAccumulator ;
46
46
47
- typedef detail::value_encrypter_impl<CiperState > StreamEncrypterImpl;
48
- typedef detail::itr_encrypter_impl<StreamEncrypterImpl, OutputIterator> EncrypterImpl;
47
+ typedef block:: detail::value_encrypter_impl<CipherAccumulator > StreamEncrypterImpl;
48
+ typedef block:: detail::itr_encrypter_impl<StreamEncrypterImpl, OutputIterator> EncrypterImpl;
49
49
50
50
return EncrypterImpl (first, last, std::move (out), CiperState (BlockCipher (key_first, key_last)));
51
51
}
52
52
53
+ /* !
54
+ * @brief
55
+ *
56
+ * @ingroup block_algorithms
57
+ *
58
+ * @tparam BlockCipher
59
+ * @tparam InputIterator
60
+ * @tparam OutputIterator
61
+ * @tparam StreamEncrypter
62
+ *
63
+ * @param first
64
+ * @param last
65
+ * @param out
66
+ *
67
+ * @return
68
+ */
69
+ template <typename BlockCipher,
70
+ typename InputIterator,
71
+ typename OutputAccumulator = typename block::block_accumulator<
72
+ typename BlockCipher::stream_encoder_type>>
73
+ OutputAccumulator &encrypt (InputIterator first, InputIterator last, typename OutputAccumulator::type &acc) {
74
+
75
+ typedef typename BlockCipher::stream_encrypter_type EncryptionMode;
76
+ typedef typename block::block_accumulator<EncryptionMode> CipherAccumulator;
77
+
78
+ typedef block::detail::ref_encrypter_impl<CipherAccumulator> StreamEncrypterImpl;
79
+ typedef block::detail::range_encrypter_impl<StreamEncrypterImpl> EncrypterImpl;
80
+
81
+ return EncrypterImpl (first, last, acc);
82
+ }
83
+
53
84
/* !
54
85
* @brief
55
86
*
@@ -65,16 +96,16 @@ namespace nil {
65
96
template <typename BlockCipher,
66
97
typename InputIterator,
67
98
typename KeyIterator,
68
- typename CipherState = typename detail::itr_stream_encrypter_traits <
69
- typename BlockCipher::stream_encrypter_type, InputIterator>::type >
70
- detail::range_encrypter_impl<detail::value_encrypter_impl<CipherState >> encrypt (InputIterator first,
71
- InputIterator last,
72
- KeyIterator key_first,
73
- KeyIterator key_last) {
74
- typedef detail::value_encrypter_impl<CipherState > StreamEncrypterImpl;
75
- typedef detail::range_encrypter_impl<StreamEncrypterImpl> EncrypterImpl;
76
-
77
- return EncrypterImpl (first, last, CipherState (BlockCipher (key_first, key_last)));
99
+ typename CipherAccumulator = typename block::block_accumulator <
100
+ typename BlockCipher::stream_encoder_type> >
101
+ detail::range_encrypter_impl<detail::value_encrypter_impl<CipherAccumulator >> encrypt (InputIterator first,
102
+ InputIterator last,
103
+ KeyIterator key_first,
104
+ KeyIterator key_last) {
105
+ typedef block:: detail::value_encrypter_impl<CipherAccumulator > StreamEncrypterImpl;
106
+ typedef block:: detail::range_encrypter_impl<StreamEncrypterImpl> EncrypterImpl;
107
+
108
+ return EncrypterImpl (first, last, CipherAccumulator (BlockCipher (key_first, key_last)));
78
109
}
79
110
80
111
/* !
@@ -96,8 +127,8 @@ namespace nil {
96
127
typedef typename detail::range_stream_encrypter_traits<typename BlockCipher::stream_encrypter_type,
97
128
SinglePassRange>::type CipherState;
98
129
99
- typedef detail::value_encrypter_impl<CipherState> StreamEncrypterImpl;
100
- typedef detail::itr_encrypter_impl<StreamEncrypterImpl, OutputIterator> EncrypterImpl;
130
+ typedef block:: detail::value_encrypter_impl<CipherState> StreamEncrypterImpl;
131
+ typedef block:: detail::itr_encrypter_impl<StreamEncrypterImpl, OutputIterator> EncrypterImpl;
101
132
102
133
return EncrypterImpl (rng, std::move (out), CipherState (BlockCipher (key)));
103
134
}
@@ -121,8 +152,8 @@ namespace nil {
121
152
detail::range_encrypter_impl<detail::value_encrypter_impl<CipherState>> encrypt (const SinglePassRange &r,
122
153
const KeyRange &key) {
123
154
124
- typedef detail::value_encrypter_impl<CipherState> StreamEncrypterImpl;
125
- typedef detail::range_encrypter_impl<StreamEncrypterImpl> EncrypterImpl;
155
+ typedef block:: detail::value_encrypter_impl<CipherState> StreamEncrypterImpl;
156
+ typedef block:: detail::range_encrypter_impl<StreamEncrypterImpl> EncrypterImpl;
126
157
127
158
return EncrypterImpl (r, CipherState (BlockCipher (key)));
128
159
}
0 commit comments