@@ -26,58 +26,60 @@ namespace nil {
26
26
namespace crypto3 {
27
27
namespace block {
28
28
namespace detail {
29
- template <typename CodecAccumulator >
29
+ template <typename CipherAccumulator >
30
30
struct ref_cipher_impl {
31
- typedef CodecAccumulator cipher_accumulator_type;
32
- typedef typename cipher_accumulator_type::type cipher_accumulator_set;
31
+ typedef CipherAccumulator accumulator_set_type;
32
+ typedef typename boost::mpl::front<
33
+ typename accumulator_set_type::features_type>::type accumulator_type;
33
34
34
- typedef typename CodecAccumulator ::mode_type mode_type;
35
+ typedef typename CipherAccumulator ::mode_type mode_type;
35
36
typedef typename mode_type::encoder_type cipher_type;
36
37
37
- ref_cipher_impl (const cipher_accumulator_set &acc) : accumulator_set(acc) {
38
+ ref_cipher_impl (const accumulator_set_type &acc) : accumulator_set(acc) {
38
39
39
40
}
40
41
41
- cipher_accumulator_set &accumulator_set;
42
+ accumulator_set_type &accumulator_set;
42
43
};
43
44
44
- template <typename CodecAccumulator >
45
+ template <typename CipherAccumulator >
45
46
struct value_cipher_impl {
46
- typedef CodecAccumulator cipher_accumulator_type;
47
- typedef typename cipher_accumulator_type::type cipher_accumulator_set;
47
+ typedef CipherAccumulator accumulator_set_type;
48
+ typedef typename boost::mpl::front<
49
+ typename accumulator_set_type::features_type>::type accumulator_type;
48
50
49
- typedef typename CodecAccumulator ::mode_type mode_type;
51
+ typedef typename CipherAccumulator ::mode_type mode_type;
50
52
typedef typename mode_type::encoder_type cipher_type;
51
53
52
- value_cipher_impl (const cipher_accumulator_set &acc) : accumulator_set(acc) {
54
+ value_cipher_impl (const accumulator_set_type &acc) : accumulator_set(acc) {
53
55
54
56
}
55
57
56
- mutable cipher_accumulator_set accumulator_set;
58
+ mutable accumulator_set_type accumulator_set;
57
59
};
58
60
59
- template <typename CodecStateImpl >
60
- struct range_cipher_impl : public CodecStateImpl {
61
- typedef CodecStateImpl cipher_state_impl_type;
61
+ template <typename CipherStateImpl >
62
+ struct range_cipher_impl : public CipherStateImpl {
63
+ typedef CipherStateImpl cipher_state_impl_type;
62
64
63
- typedef typename cipher_state_impl_type::cipher_accumulator_type cipher_accumulator_type ;
64
- typedef typename cipher_accumulator_type::type cipher_accumulator_set ;
65
+ typedef typename cipher_state_impl_type::accumulator_type accumulator_type ;
66
+ typedef typename cipher_state_impl_type::accumulator_set_type accumulator_set_type ;
65
67
66
68
typedef typename cipher_state_impl_type::mode_type mode_type;
67
69
typedef typename cipher_state_impl_type::cipher_type cipher_type;
68
70
69
- typedef typename boost::mpl::apply<cipher_accumulator_set, accumulators::tag::block<
70
- mode_type> >::type::result_type result_type;
71
+ typedef typename boost::mpl::apply<accumulator_set_type,
72
+ accumulator_type >::type::result_type result_type;
71
73
72
74
template <typename SinglePassRange>
73
- range_cipher_impl (const SinglePassRange &range, const cipher_accumulator_set &ise)
74
- : CodecStateImpl (ise) {
75
+ range_cipher_impl (const SinglePassRange &range, const accumulator_set_type &ise)
76
+ : CipherStateImpl (ise) {
75
77
BOOST_RANGE_CONCEPT_ASSERT ((boost::SinglePassRangeConcept<const SinglePassRange>));
76
78
77
79
typedef typename std::iterator_traits<
78
80
typename SinglePassRange::iterator>::value_type value_type;
79
81
BOOST_STATIC_ASSERT (std::numeric_limits<value_type>::is_specialized);
80
- typedef typename cipher_type::template stream_processor<mode_type, cipher_accumulator_set ,
82
+ typedef typename cipher_type::template stream_processor<mode_type, accumulator_set_type ,
81
83
std::numeric_limits<
82
84
value_type>::digits +
83
85
std::numeric_limits<
@@ -88,13 +90,13 @@ namespace nil {
88
90
}
89
91
90
92
template <typename InputIterator>
91
- range_cipher_impl (InputIterator first, InputIterator last, const cipher_accumulator_set &ise)
92
- : CodecStateImpl (ise) {
93
+ range_cipher_impl (InputIterator first, InputIterator last, const accumulator_set_type &ise)
94
+ : CipherStateImpl (ise) {
93
95
BOOST_CONCEPT_ASSERT ((boost::InputIteratorConcept<InputIterator>));
94
96
95
97
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
96
98
BOOST_STATIC_ASSERT (std::numeric_limits<value_type>::is_specialized);
97
- typedef typename cipher_type::template stream_processor<mode_type, cipher_accumulator_set ,
99
+ typedef typename cipher_type::template stream_processor<mode_type, accumulator_set_type ,
98
100
std::numeric_limits<
99
101
value_type>::digits +
100
102
std::numeric_limits<
@@ -105,54 +107,55 @@ namespace nil {
105
107
106
108
template <typename OutputRange>
107
109
operator OutputRange () const {
108
- result_type result = accumulators::extract::block<mode_type>(this ->accumulator_set );
110
+ result_type result = boost::accumulators::extract_result<accumulator_type>(
111
+ this ->accumulator_set );
109
112
return OutputRange (result.cbegin (), result.cend ());
110
113
}
111
114
112
115
operator result_type () const {
113
- return accumulators::extract::block<mode_type >(this ->accumulator_set );
116
+ return boost::accumulators::extract_result<accumulator_type >(this ->accumulator_set );
114
117
}
115
118
116
- operator cipher_accumulator_set () const {
119
+ operator accumulator_set_type () const {
117
120
return this ->accumulator_set ;
118
121
}
119
122
120
123
#ifdef CRYPTO3_ASCII_STRING_CODEC_OUTPUT
121
124
122
125
template <typename Char, typename CharTraits, typename Alloc>
123
126
operator std::basic_string<Char, CharTraits, Alloc>() const {
124
- return std::to_string (accumulators::extract::cipher<mode_type >(this ->accumulator_set ));
127
+ return std::to_string (boost::accumulators::extract_result<accumulator_type >(this ->accumulator_set ));
125
128
}
126
129
127
130
#endif
128
131
};
129
132
130
- template <typename CodecStateImpl , typename OutputIterator>
131
- struct itr_cipher_impl : public CodecStateImpl {
133
+ template <typename CipherStateImpl , typename OutputIterator>
134
+ struct itr_cipher_impl : public CipherStateImpl {
132
135
private:
133
136
mutable OutputIterator out;
134
137
135
138
public:
136
- typedef CodecStateImpl cipher_state_impl_type;
139
+ typedef CipherStateImpl cipher_state_impl_type;
137
140
138
- typedef typename cipher_state_impl_type::cipher_accumulator_type cipher_accumulator_type ;
139
- typedef typename cipher_accumulator_type::type cipher_accumulator_set ;
141
+ typedef typename cipher_state_impl_type::accumulator_type accumulator_type ;
142
+ typedef typename cipher_state_impl_type::accumulator_set_type accumulator_set_type ;
140
143
141
144
typedef typename cipher_state_impl_type::mode_type mode_type;
142
145
typedef typename cipher_state_impl_type::cipher_type cipher_type;
143
146
144
- typedef typename boost::mpl::apply<cipher_accumulator_set, accumulators::tag::block<
145
- mode_type> >::type::result_type result_type;
147
+ typedef typename boost::mpl::apply<accumulator_set_type,
148
+ accumulator_type >::type::result_type result_type;
146
149
147
150
template <typename SinglePassRange>
148
- itr_cipher_impl (const SinglePassRange &range, OutputIterator out, const cipher_accumulator_set &ise)
149
- : CodecStateImpl (ise), out(std::move(out)) {
151
+ itr_cipher_impl (const SinglePassRange &range, OutputIterator out, const accumulator_set_type &ise)
152
+ : CipherStateImpl (ise), out(std::move(out)) {
150
153
BOOST_CONCEPT_ASSERT ((boost::SinglePassRangeConcept<const SinglePassRange>));
151
154
152
155
typedef typename std::iterator_traits<
153
156
typename SinglePassRange::iterator>::value_type value_type;
154
157
BOOST_STATIC_ASSERT (std::numeric_limits<value_type>::is_specialized);
155
- typedef typename cipher_type::template stream_processor<mode_type, cipher_accumulator_set ,
158
+ typedef typename cipher_type::template stream_processor<mode_type, accumulator_set_type ,
156
159
std::numeric_limits<
157
160
value_type>::digits +
158
161
std::numeric_limits<
@@ -164,13 +167,13 @@ namespace nil {
164
167
165
168
template <typename InputIterator>
166
169
itr_cipher_impl (InputIterator first, InputIterator last, OutputIterator out,
167
- const cipher_accumulator_set &ise)
168
- : CodecStateImpl (ise), out(std::move(out)) {
170
+ const accumulator_set_type &ise)
171
+ : CipherStateImpl (ise), out(std::move(out)) {
169
172
BOOST_CONCEPT_ASSERT ((boost::InputIteratorConcept<InputIterator>));
170
173
171
174
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
172
175
BOOST_STATIC_ASSERT (std::numeric_limits<value_type>::is_specialized);
173
- typedef typename cipher_type::template stream_processor<mode_type, cipher_accumulator_set ,
176
+ typedef typename cipher_type::template stream_processor<mode_type, accumulator_set_type ,
174
177
std::numeric_limits<
175
178
value_type>::digits +
176
179
std::numeric_limits<
@@ -181,7 +184,8 @@ namespace nil {
181
184
}
182
185
183
186
operator OutputIterator () const {
184
- result_type result = accumulators::extract::block<mode_type>(this ->accumulator_set );
187
+ result_type result = boost::accumulators::extract_result<accumulator_type>(
188
+ this ->accumulator_set );
185
189
186
190
return std::move (result.cbegin (), result.cend (), out);
187
191
}
0 commit comments