#include <edwards_g2.hpp>
Definition at line 22 of file edwards_g2.hpp.
◆ base_field
◆ scalar_field
◆ twist_field
◆ edwards_G2() [1/2]
libff::edwards_G2::edwards_G2 |
( |
| ) |
|
Definition at line 24 of file edwards_g2.cpp.
25{
27 {
31 }
32}
static edwards_G2 G2_zero
◆ edwards_G2() [2/2]
◆ add()
Definition at line 202 of file edwards_g2.cpp.
203{
204#ifdef PROFILE_OP_COUNTS
205 this->add_cnt++;
206#endif
207
208
209
220
222}
static edwards_Fq3 mul_by_a(const edwards_Fq3 &elt)
static edwards_Fq3 mul_by_d(const edwards_Fq3 &elt)
#define D(var, file, col, who, lev,...)
Fp3_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq3
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::edwards_G2::batch_to_special_all_non_zeros |
( |
std::vector< edwards_G2 > & | vec | ) |
|
|
static |
Definition at line 396 of file edwards_g2.cpp.
397{
398 std::vector<edwards_Fq3> Z_vec;
399 Z_vec.reserve(vec.size());
400
401 for (auto &el: vec)
402 {
403 Z_vec.emplace_back(el.Z);
404 }
406
408
409 for (size_t i = 0; i < vec.size(); ++i)
410 {
411 vec[i].X = vec[i].X * Z_vec[i];
412 vec[i].Y = vec[i].Y * Z_vec[i];
414 }
415}
static Fp3_model< n, modulus > one()
void batch_invert(std::vector< FieldT > &vec)
◆ dbl()
Definition at line 261 of file edwards_g2.cpp.
262{
263#ifdef PROFILE_OP_COUNTS
264 this->dbl_cnt++;
265#endif
267 {
268 return (*this);
269 }
270 else
271 {
272
273
274
285
287 }
288}
Fp3_model squared() const
◆ is_special()
bool libff::edwards_G2::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::edwards_G2::is_well_formed |
( |
| ) |
const |
Definition at line 297 of file edwards_g2.cpp.
298{
299
300
302 {
303 return true;
304 }
305 else
306 {
307
308
309
310
311
312
313
314
320 return (Z2 * (aY2 + X2 - dZ2) == X2 * Y2);
321 }
322}
◆ is_zero()
bool libff::edwards_G2::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 224 of file edwards_g2.cpp.
225{
226#ifdef PROFILE_OP_COUNTS
227 this->add_cnt++;
228#endif
229
231 {
233 }
234
236 {
237 return *this;
238 }
239
240#ifdef DEBUG
241 assert(
other.is_special());
242#endif
243
244
245
246
257
259}
◆ mul_by_a()
Definition at line 34 of file edwards_g2.cpp.
35{
36
37
38
40}
edwards_Fq edwards_twist_mul_by_a_c0
◆ mul_by_d()
Definition at line 42 of file edwards_g2.cpp.
43{
45}
edwards_Fq edwards_twist_mul_by_d_c1
edwards_Fq edwards_twist_mul_by_d_c2
edwards_Fq edwards_twist_mul_by_d_c0
◆ mul_by_q()
Definition at line 290 of file edwards_g2.cpp.
291{
295}
edwards_Fq edwards_twist_mul_by_q_Y
edwards_Fq edwards_twist_mul_by_q_Z
◆ one()
◆ operator!=()
bool libff::edwards_G2::operator!= |
( |
const edwards_G2 & | other | ) |
const |
Definition at line 170 of file edwards_g2.cpp.
171{
173}
bool operator==(const edwards_G2 &other) const
◆ operator+()
Definition at line 175 of file edwards_g2.cpp.
176{
177
179 {
181 }
182
184 {
185 return (*this);
186 }
187
188 return this->
add(other);
189}
edwards_G2 add(const edwards_G2 &other) const
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator==()
bool libff::edwards_G2::operator== |
( |
const edwards_G2 & | other | ) |
const |
Definition at line 141 of file edwards_g2.cpp.
142{
144 {
145 return other.is_zero();
146 }
147
149 {
150 return false;
151 }
152
153
154
155
157 {
158 return false;
159 }
160
161
163 {
164 return false;
165 }
166
167 return true;
168}
◆ order()
◆ print()
void libff::edwards_G2::print |
( |
| ) |
const |
Definition at line 47 of file edwards_g2.cpp.
48{
50 {
52 }
53 else
54 {
56 copy.to_affine_coordinates();
57 gmp_printf("(%Nd*z^2 + %Nd*z + %Nd , %Nd*z^2 + %Nd*z + %Nd)\n",
64 }
65}
static const mp_size_t num_limbs
LOGGING_API void printf(Category category, const char *format,...)
void copy(const path &from, const path &to)
◆ print_coordinates()
void libff::edwards_G2::print_coordinates |
( |
| ) |
const |
Definition at line 67 of file edwards_g2.cpp.
68{
70 {
72 }
73 else
74 {
75 gmp_printf("(%Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd)\n",
85 }
86}
◆ random_element()
Definition at line 334 of file edwards_g2.cpp.
335{
337}
static Fp_model< n, modulus > random_element()
◆ size_in_bits()
static size_t libff::edwards_G2::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::edwards_G2::to_affine_coordinates |
( |
| ) |
|
Definition at line 88 of file edwards_g2.cpp.
89{
91 {
95 }
96 else
97 {
98
102
104 this->
X = tX * tZ_inv;
105 this->Y = tY * tZ_inv;
107 }
108}
Fp3_model inverse() const
static Fp3_model< n, modulus > zero()
◆ to_special()
void libff::edwards_G2::to_special |
( |
| ) |
|
Definition at line 110 of file edwards_g2.cpp.
111{
113 {
114 return;
115 }
116
117#ifdef DEBUG
119#endif
120
122 this->
X = this->
X * Z_inv;
123 this->
Y = this->
Y * Z_inv;
125
126#ifdef DEBUG
127 assert((*this) == copy);
128#endif
129}
◆ zero()
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const edwards_G2 & | g ) |
|
friend |
Definition at line 339 of file edwards_g2.cpp.
340{
342 copy.to_affine_coordinates();
343#ifdef NO_PT_COMPRESSION
345#else
346
348#endif
349 return out;
350}
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
edwards_G2 & | g ) |
|
friend |
Definition at line 352 of file edwards_g2.cpp.
353{
355
356#ifdef NO_PT_COMPRESSION
357 in >> tX;
359 in >> tY;
360#else
361
362
363
364
365 unsigned char Y_lsb;
366 in >> tX;
368
369 in.read((char*)&Y_lsb, 1);
370 Y_lsb -= '0';
371
377
378 if ((tY.c0.as_bigint().data[0] & 1) != Y_lsb)
379 {
380 tY = -tY;
381 }
382#endif
383
384
385 g.X = tY;
386 g.Y = tX;
387 g.Z = tX * tY;
388
389#ifdef USE_MIXED_ADDITION
390 g.to_special();
391#endif
392
393 return in;
394}
void consume_OUTPUT_SEPARATOR(std::istream &in)
◆ fixed_base_exp_window_table
std::vector< size_t > libff::edwards_G2::fixed_base_exp_window_table |
|
static |
◆ G2_one
◆ G2_zero
◆ initialized
bool libff::edwards_G2::initialized = false |
|
static |
◆ wnaf_window_table
std::vector< size_t > libff::edwards_G2::wnaf_window_table |
|
static |
The documentation for this class was generated from the following files: