@@ -125,7 +125,6 @@ namespace nil {
125
125
126
126
template <typename Endianness, typename Coordinates>
127
127
struct curve_element_writer <
128
-
129
128
Endianness,
130
129
typename algebra::curves::bls12_381::template g2_type<Coordinates,
131
130
algebra::curves::forms::short_weierstrass>> {
@@ -175,7 +174,6 @@ namespace nil {
175
174
176
175
template <typename Coordinates>
177
176
struct curve_element_writer <
178
-
179
177
nil::marshalling::endian::little_endian,
180
178
typename algebra::curves::curve25519::template g1_type<Coordinates,
181
179
algebra::curves::forms::twisted_edwards>> {
@@ -240,12 +238,26 @@ namespace nil {
240
238
// / https://zips.z.cash/protocol/protocol.pdf#concreteextractorjubjub
241
239
template <typename TIter>
242
240
static nil::marshalling::status_type process (const group_value_type &point, TIter &iter) {
243
- write_data<params_type::bit_length (), endianness>(
241
+ write_data<params_type::bit_length (), endianness>(
244
242
static_cast <typename group_value_type::field_type::integral_type>(point.to_affine ().X .data ),
245
243
iter);
246
244
247
245
return nil::marshalling::status_type::success;
248
246
}
247
+
248
+ // TODO: refactor
249
+ template <>
250
+ static nil::marshalling::status_type
251
+ process<typename std::vector<bool >::iterator>(const group_value_type &point,
252
+ typename std::vector<bool >::iterator &iter) {
253
+ auto X_affine = static_cast <typename group_value_type::field_type::integral_type>(point.to_affine ().X .data );
254
+ for (std::size_t i = 0 ; i < params_type::bit_length (); ++i) {
255
+ *iter++ = bit_test (X_affine, 0 );
256
+ X_affine >>= 1 ;
257
+ }
258
+
259
+ return nil::marshalling::status_type::success;
260
+ }
249
261
};
250
262
251
263
template <typename Endianness, typename Coordinates>
0 commit comments