#include <edwards_g1.hpp>
Definition at line 21 of file edwards_g1.hpp.
◆ base_field
◆ scalar_field
◆ edwards_G1() [1/2]
libff::edwards_G1::edwards_G1 |
( |
| ) |
|
Definition at line 23 of file edwards_g1.cpp.
24{
26 {
30 }
31}
static edwards_G1 G1_zero
◆ edwards_G1() [2/2]
◆ add()
Definition at line 178 of file edwards_g1.cpp.
179{
180#ifdef PROFILE_OP_COUNTS
181 this->add_cnt++;
182#endif
183
184
185
196
198}
#define D(var, file, col, who, lev,...)
Fp_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq
edwards_Fq edwards_coeff_d
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::edwards_G1::batch_to_special_all_non_zeros |
( |
std::vector< edwards_G1 > & | vec | ) |
|
|
static |
Definition at line 395 of file edwards_g1.cpp.
396{
397 std::vector<edwards_Fq> Z_vec;
398 Z_vec.reserve(vec.size());
399
400 for (auto &el: vec)
401 {
402 Z_vec.emplace_back(el.Z);
403 }
405
407
408 for (size_t i = 0; i < vec.size(); ++i)
409 {
410 vec[i].X = vec[i].X * Z_vec[i];
411 vec[i].Y = vec[i].Y * Z_vec[i];
413 }
414}
static Fp_model< n, modulus > one()
void batch_invert(std::vector< FieldT > &vec)
◆ dbl()
Definition at line 237 of file edwards_g1.cpp.
238{
239#ifdef PROFILE_OP_COUNTS
240 this->dbl_cnt++;
241#endif
243 {
244 return (*this);
245 }
246 else
247 {
248
249
250
260
262 }
263}
◆ is_special()
bool libff::edwards_G1::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::edwards_G1::is_well_formed |
( |
| ) |
const |
Definition at line 265 of file edwards_g1.cpp.
266{
267
268
270 {
271 return true;
272 }
273 else
274 {
275
276
277
278
279
280
281
282
286
287
289 }
290}
◆ is_zero()
bool libff::edwards_G1::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 200 of file edwards_g1.cpp.
201{
202#ifdef PROFILE_OP_COUNTS
203 this->add_cnt++;
204#endif
205
207 {
209 }
210
212 {
213 return *this;
214 }
215
216#ifdef DEBUG
217 assert(
other.is_special());
218#endif
219
220
221
222
233
235}
◆ one()
◆ operator!=()
bool libff::edwards_G1::operator!= |
( |
const edwards_G1 & | other | ) |
const |
Definition at line 146 of file edwards_g1.cpp.
147{
149}
bool operator==(const edwards_G1 &other) const
◆ operator+()
Definition at line 151 of file edwards_g1.cpp.
152{
153
155 {
157 }
158
160 {
161 return (*this);
162 }
163
164 return this->
add(other);
165}
edwards_G1 add(const edwards_G1 &other) const
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator==()
bool libff::edwards_G1::operator== |
( |
const edwards_G1 & | other | ) |
const |
Definition at line 117 of file edwards_g1.cpp.
118{
120 {
121 return other.is_zero();
122 }
123
125 {
126 return false;
127 }
128
129
130
131
133 {
134 return false;
135 }
136
137
139 {
140 return false;
141 }
142
143 return true;
144}
◆ order()
◆ print()
void libff::edwards_G1::print |
( |
| ) |
const |
Definition at line 33 of file edwards_g1.cpp.
34{
36 {
38 }
39 else
40 {
42 copy.to_affine_coordinates();
43 gmp_printf("(%Nd , %Nd)\n",
46 }
47}
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_G1::print_coordinates |
( |
| ) |
const |
Definition at line 49 of file edwards_g1.cpp.
50{
52 {
54 }
55 else
56 {
57 gmp_printf("(%Nd : %Nd : %Nd)\n",
61 }
62}
◆ random_element()
Definition at line 302 of file edwards_g1.cpp.
303{
305}
static Fp_model< n, modulus > random_element()
◆ size_in_bits()
static size_t libff::edwards_G1::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::edwards_G1::to_affine_coordinates |
( |
| ) |
|
Definition at line 64 of file edwards_g1.cpp.
65{
67 {
71 }
72 else
73 {
74
78
80 this->
X = tX * tZ_inv;
81 this->Y = tY * tZ_inv;
83 }
84}
static Fp_model< n, modulus > zero()
◆ to_special()
void libff::edwards_G1::to_special |
( |
| ) |
|
Definition at line 86 of file edwards_g1.cpp.
87{
89 {
90 return;
91 }
92
93#ifdef DEBUG
95#endif
96
98 this->
X = this->
X * Z_inv;
99 this->
Y = this->
Y * Z_inv;
101
102#ifdef DEBUG
103 assert((*this) == copy);
104#endif
105}
◆ zero()
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const edwards_G1 & | g ) |
|
friend |
Definition at line 307 of file edwards_g1.cpp.
308{
310 copy.to_affine_coordinates();
311#ifdef NO_PT_COMPRESSION
313#else
314
316#endif
317
318 return out;
319}
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
edwards_G1 & | g ) |
|
friend |
Definition at line 321 of file edwards_g1.cpp.
322{
324
325#ifdef NO_PT_COMPRESSION
326 in >> tX;
328 in >> tY;
329#else
330
331
332
333
334 unsigned char Y_lsb;
335 in >> tX;
336
338 in.read((char*)&Y_lsb, 1);
339 Y_lsb -= '0';
340
345
346 if ((tY.as_bigint().data[0] & 1) != Y_lsb)
347 {
348 tY = -tY;
349 }
350#endif
351
352
353 g.X = tY;
354 g.Y = tX;
355 g.Z = tX * tY;
356
357#ifdef USE_MIXED_ADDITION
358 g.to_special();
359#endif
360
361 return in;
362}
void consume_OUTPUT_SEPARATOR(std::istream &in)
◆ fixed_base_exp_window_table
std::vector< size_t > libff::edwards_G1::fixed_base_exp_window_table |
|
static |
◆ G1_one
◆ G1_zero
◆ initialized
bool libff::edwards_G1::initialized = false |
|
static |
◆ wnaf_window_table
std::vector< size_t > libff::edwards_G1::wnaf_window_table |
|
static |
The documentation for this class was generated from the following files: