Clearmatics Libff  0.1
C++ library for Finite Fields and Elliptic Curves
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
libff::bw6_761_G2 Class Reference

#include <bw6_761_g2.hpp>

Collaboration diagram for libff::bw6_761_G2:
Collaboration graph
[legend]

Public Types

typedef bw6_761_Fq base_field
 
typedef bw6_761_Fq twist_field
 
typedef bw6_761_Fr scalar_field
 

Public Member Functions

 bw6_761_G2 ()
 
 bw6_761_G2 (const bw6_761_Fq &X, const bw6_761_Fq &Y, const bw6_761_Fq &Z)
 
void print () const
 
void print_coordinates () const
 
void to_affine_coordinates ()
 
void to_special ()
 
bool is_special () const
 
bool is_zero () const
 
bool operator== (const bw6_761_G2 &other) const
 
bool operator!= (const bw6_761_G2 &other) const
 
bw6_761_G2 operator+ (const bw6_761_G2 &other) const
 
bw6_761_G2 operator- () const
 
bw6_761_G2 operator- (const bw6_761_G2 &other) const
 
bw6_761_G2 add (const bw6_761_G2 &other) const
 
bw6_761_G2 mixed_add (const bw6_761_G2 &other) const
 
bw6_761_G2 dbl () const
 
bw6_761_G2 mul_by_q () const
 
bw6_761_G2 mul_by_cofactor () const
 
bool is_well_formed () const
 
bool is_in_safe_subgroup () const
 
void write_uncompressed (std::ostream &) const
 
void write_compressed (std::ostream &) const
 

Static Public Member Functions

static bw6_761_Fq mul_by_b (const bw6_761_Fq &elt)
 
static const bw6_761_G2zero ()
 
static const bw6_761_G2one ()
 
static bw6_761_G2 random_element ()
 
static size_t size_in_bits ()
 
static bigint< base_field::num_limbsbase_field_char ()
 
static bigint< scalar_field::num_limbsorder ()
 
static void read_uncompressed (std::istream &, bw6_761_G2 &)
 
static void read_compressed (std::istream &, bw6_761_G2 &)
 
static void batch_to_special_all_non_zeros (std::vector< bw6_761_G2 > &vec)
 

Public Attributes

bw6_761_Fq X
 
bw6_761_Fq Y
 
bw6_761_Fq Z
 

Static Public Attributes

static std::vector< size_t > wnaf_window_table
 
static std::vector< size_t > fixed_base_exp_window_table
 
static bw6_761_G2 G2_zero
 
static bw6_761_G2 G2_one
 
static bw6_761_Fq coeff_a
 
static bw6_761_Fq coeff_b
 
static const mp_size_t h_bitcount = 384
 
static const mp_size_t h_limbs
 
static bigint< h_limbsh
 

Detailed Description

Definition at line 15 of file bw6_761_g2.hpp.

Member Typedef Documentation

◆ base_field

Definition at line 29 of file bw6_761_g2.hpp.

◆ scalar_field

Definition at line 31 of file bw6_761_g2.hpp.

◆ twist_field

Definition at line 30 of file bw6_761_g2.hpp.

Constructor & Destructor Documentation

◆ bw6_761_G2() [1/2]

libff::bw6_761_G2::bw6_761_G2 ( )

Definition at line 19 of file bw6_761_g2.cpp.

20 {
21  this->X = G2_zero.X;
22  this->Y = G2_zero.Y;
23  this->Z = G2_zero.Z;
24 }
Here is the caller graph for this function:

◆ bw6_761_G2() [2/2]

libff::bw6_761_G2::bw6_761_G2 ( const bw6_761_Fq X,
const bw6_761_Fq Y,
const bw6_761_Fq Z 
)
inline

Definition at line 43 of file bw6_761_g2.hpp.

44  : X(X), Y(Y), Z(Z)
45  {
46  }

Member Function Documentation

◆ add()

bw6_761_G2 libff::bw6_761_G2::add ( const bw6_761_G2 other) const

Definition at line 211 of file bw6_761_g2.cpp.

212 {
213  // handle special cases having to do with O
214  if (this->is_zero()) {
215  return other;
216  }
217 
218  if (other.is_zero()) {
219  return (*this);
220  }
221 
222  // no need to handle points of order 2,4
223  // (they cannot exist in a prime-order subgroup)
224 
225  // handle double case
226  if (this->operator==(other)) {
227  return this->dbl();
228  }
229 
230 #ifdef PROFILE_OP_COUNTS
231  this->add_cnt++;
232 #endif
233  // NOTE: does not handle O and pts of order 2,4
234  // Point addition (i.e. P + Q, P =/= Q)
235  // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-projective.html#addition-add-1998-cmo-2
236  // Y1Z2 = Y1*Z2
237  const bw6_761_Fq Y1Z2 = (this->Y) * (other.Z);
238  // X1Z2 = X1*Z2
239  const bw6_761_Fq X1Z2 = (this->X) * (other.Z);
240  // Z1Z2 = Z1*Z2
241  const bw6_761_Fq Z1Z2 = (this->Z) * (other.Z);
242  // u = Y2*Z1-Y1Z2
243  const bw6_761_Fq u = (other.Y) * (this->Z) - Y1Z2;
244  // uu = u^2
245  const bw6_761_Fq uu = u.squared();
246  // v = X2*Z1-X1Z2
247  const bw6_761_Fq v = (other.X) * (this->Z) - X1Z2;
248  // vv = v^2
249  const bw6_761_Fq vv = v.squared();
250  // vvv = v*vv
251  const bw6_761_Fq vvv = v * vv;
252  // R = vv*X1Z2
253  const bw6_761_Fq R = vv * X1Z2;
254  // A = uu*Z1Z2 - vvv - 2*R
255  const bw6_761_Fq A = uu * Z1Z2 - (vvv + R + R);
256  // X3 = v*A
257  const bw6_761_Fq X3 = v * A;
258  // Y3 = u*(R-A) - vvv*Y1Z2
259  const bw6_761_Fq Y3 = u * (R - A) - vvv * Y1Z2;
260  // Z3 = vvv*Z1Z2
261  const bw6_761_Fq Z3 = vvv * Z1Z2;
262 
263  return bw6_761_G2(X3, Y3, Z3);
264 }
Here is the call graph for this function:

◆ base_field_char()

static bigint<base_field::num_limbs> libff::bw6_761_G2::base_field_char ( )
inlinestatic

Definition at line 80 of file bw6_761_g2.hpp.

81  {
82  return base_field::field_char();
83  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ batch_to_special_all_non_zeros()

void libff::bw6_761_G2::batch_to_special_all_non_zeros ( std::vector< bw6_761_G2 > &  vec)
static

Definition at line 498 of file bw6_761_g2.cpp.

499 {
500  std::vector<bw6_761_Fq> Z_vec;
501  Z_vec.reserve(vec.size());
502 
503  for (auto &el : vec) {
504  Z_vec.emplace_back(el.Z);
505  }
506  batch_invert<bw6_761_Fq>(Z_vec);
507 
508  const bw6_761_Fq one = bw6_761_Fq::one();
509 
510  for (size_t i = 0; i < vec.size(); ++i) {
511  vec[i].X = vec[i].X * Z_vec[i];
512  vec[i].Y = vec[i].Y * Z_vec[i];
513  vec[i].Z = one;
514  }
515 }
Here is the call graph for this function:

◆ dbl()

bw6_761_G2 libff::bw6_761_G2::dbl ( ) const

Definition at line 324 of file bw6_761_g2.cpp.

325 {
326 #ifdef PROFILE_OP_COUNTS
327  this->dbl_cnt++;
328 #endif
329  if (this->is_zero()) {
330  return (*this);
331  }
332 
333  // NOTE: does not handle O and pts of order 2,4
334  // (they cannot exist in a prime-order subgroup)
335 
336  // Point doubling (i.e. P + P)
337  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/projective/doubling/dbl-2007-bl
338  // XX = X1^2
339  const bw6_761_Fq XX = (this->X).squared();
340  // w = a*ZZ + 3*XX = 3*XX (since a=0)
341  const bw6_761_Fq w = XX + XX + XX;
342  const bw6_761_Fq Y1Z1 = (this->Y) * (this->Z);
343  // s = 2*Y1*Z1
344  const bw6_761_Fq s = Y1Z1 + Y1Z1;
345  // ss = s^2
346  const bw6_761_Fq ss = s.squared();
347  // sss = s*ss
348  const bw6_761_Fq sss = s * ss;
349  // R = Y1*s
350  const bw6_761_Fq R = (this->Y) * s;
351  // RR = R^2
352  const bw6_761_Fq RR = R.squared();
353  // B = (X1+R)^2 - XX - RR
354  const bw6_761_Fq B = ((this->X) + R).squared() - XX - RR;
355  // h = w^2 - 2*B
356  const bw6_761_Fq h = w.squared() - (B + B);
357  // X3 = h*s
358  const bw6_761_Fq X3 = h * s;
359  // Y3 = w*(B-h) - 2*RR
360  const bw6_761_Fq Y3 = w * (B - h) - (RR + RR);
361  // Z3 = sss
362  const bw6_761_Fq Z3 = sss;
363  return bw6_761_G2(X3, Y3, Z3);
364 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_in_safe_subgroup()

bool libff::bw6_761_G2::is_in_safe_subgroup ( ) const

Definition at line 396 of file bw6_761_g2.cpp.

397 {
398  return zero() == scalar_field::mod * (*this);
399 }
Here is the call graph for this function:

◆ is_special()

bool libff::bw6_761_G2::is_special ( ) const

Definition at line 79 of file bw6_761_g2.cpp.

80 {
81  return (this->is_zero() || this->Z == bw6_761_Fq::one());
82 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_well_formed()

bool libff::bw6_761_G2::is_well_formed ( ) const

Definition at line 376 of file bw6_761_g2.cpp.

377 {
378  if (this->is_zero()) {
379  return true;
380  }
381 
382  // The curve equation is
383  // E': y^2 = x^3 + ax + b', where a=0 and b'= b*xi
384  // We are using Projective coordinates. As such, the equation becomes:
385  // (y/z)^2 = (x/z)^3 + a (x/z) + b'
386  // = z y^2 = x^3 + a z^2 x + b' z^3
387  // = z (y^2 - b' z^2) = x ( x^2 + a z^2)
388  // = z (y^2 - b' z^2) = x^3, since a = 0
389  const bw6_761_Fq X2 = this->X.squared();
390  const bw6_761_Fq Y2 = this->Y.squared();
391  const bw6_761_Fq Z2 = this->Z.squared();
392 
393  return (this->Z * (Y2 - bw6_761_twist_coeff_b * Z2) == this->X * X2);
394 }
Here is the call graph for this function:

◆ is_zero()

bool libff::bw6_761_G2::is_zero ( ) const

Definition at line 84 of file bw6_761_g2.cpp.

85 {
86  return (this->X.is_zero() && this->Z.is_zero());
87 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mixed_add()

bw6_761_G2 libff::bw6_761_G2::mixed_add ( const bw6_761_G2 other) const

Definition at line 269 of file bw6_761_g2.cpp.

270 {
271 #ifdef DEBUG
272  assert(other.is_special());
273 #endif
274 
275  if (this->is_zero()) {
276  return other;
277  }
278 
279  if (other.is_zero()) {
280  return (*this);
281  }
282 
283  // X2Z1 = X2*Z1
284  const bw6_761_Fq X2Z1 = (this->Z) * (other.X);
285  // Y2Z1 = Y2*Z1
286  const bw6_761_Fq Y2Z1 = (this->Z) * (other.Y);
287 
288  // (X1/Z1) == X2 => X1 == X2Z1
289  // (Y1/Z1) == Y2 => Y1 == Y2Z1
290  if (this->X == X2Z1 && this->Y == Y2Z1) {
291  return this->dbl();
292  }
293 
294 #ifdef PROFILE_OP_COUNTS
295  this->add_cnt++;
296 #endif
297 
298  // Mixed point addition
299  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/projective/addition/madd-1998-cmo
300  // u = Y2*Z1-Y1
301  bw6_761_Fq u = Y2Z1 - this->Y;
302  // uu = u2
303  bw6_761_Fq uu = u.squared();
304  // v = X2*Z1-X1
305  bw6_761_Fq v = X2Z1 - this->X;
306  // vv = v2
307  bw6_761_Fq vv = v.squared();
308  // vvv = v*vv
309  bw6_761_Fq vvv = v * vv;
310  // R = vv*X1
311  bw6_761_Fq R = vv * this->X;
312  // A = uu*Z1-vvv-2*R
313  bw6_761_Fq A = uu * this->Z - vvv - R - R;
314  // X3 = v*A
315  bw6_761_Fq X3 = v * A;
316  // Y3 = u*(R-A)-vvv*Y1
317  bw6_761_Fq Y3 = u * (R - A) - vvv * this->Y;
318  // Z3 = vvv*Z1
319  bw6_761_Fq Z3 = vvv * this->Z;
320 
321  return bw6_761_G2(X3, Y3, Z3);
322 }
Here is the call graph for this function:

◆ mul_by_b()

bw6_761_Fq libff::bw6_761_G2::mul_by_b ( const bw6_761_Fq elt)
static

Definition at line 26 of file bw6_761_g2.cpp.

27 {
28  return bw6_761_twist_coeff_b * elt;
29 }

◆ mul_by_cofactor()

bw6_761_G2 libff::bw6_761_G2::mul_by_cofactor ( ) const

Definition at line 371 of file bw6_761_g2.cpp.

372 {
373  return bw6_761_G2::h * (*this);
374 }

◆ mul_by_q()

bw6_761_G2 libff::bw6_761_G2::mul_by_q ( ) const

Definition at line 366 of file bw6_761_g2.cpp.

367 {
368  return bw6_761_G2::base_field_char() * (*this);
369 }
Here is the call graph for this function:

◆ one()

const bw6_761_G2 & libff::bw6_761_G2::one ( )
static

Definition at line 403 of file bw6_761_g2.cpp.

403 { return G2_one; }
Here is the caller graph for this function:

◆ operator!=()

bool libff::bw6_761_G2::operator!= ( const bw6_761_G2 other) const

Definition at line 111 of file bw6_761_g2.cpp.

112 {
113  return !(operator==(other));
114 }
Here is the call graph for this function:

◆ operator+()

bw6_761_G2 libff::bw6_761_G2::operator+ ( const bw6_761_G2 other) const

Definition at line 116 of file bw6_761_g2.cpp.

117 {
118  // Handle special cases having to do with O
119  if (this->is_zero()) {
120  return other;
121  }
122 
123  if (other.is_zero()) {
124  return *this;
125  }
126 
127  // No need to handle points of order 2,4
128  // (they cannot exist in a prime-order subgroup)
129 
130  // X1Z2 = X1*Z2
131  const bw6_761_Fq X1Z2 = (this->X) * (other.Z);
132  // X2Z1 = X2*Z1
133  const bw6_761_Fq X2Z1 = (this->Z) * (other.X);
134 
135  // Y1Z2 = Y1*Z2
136  const bw6_761_Fq Y1Z2 = (this->Y) * (other.Z);
137  // Y2Z1 = Y2*Z1
138  const bw6_761_Fq Y2Z1 = (this->Z) * (other.Y);
139 
140  // Check if the 2 points are equal, in which can we do a point doubling
141  // (i.e. P + P)
142  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/projective/doubling/dbl-2007-bl
143  if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
144  // XX = X1^2
145  const bw6_761_Fq XX = (this->X).squared();
146  // w = a*ZZ + 3*XX = 3*XX (since a=0)
147  const bw6_761_Fq w = XX + XX + XX;
148  const bw6_761_Fq Y1Z1 = (this->Y) * (this->Z);
149  // s = 2*Y1*Z1
150  const bw6_761_Fq s = Y1Z1 + Y1Z1;
151  // ss = s^2
152  const bw6_761_Fq ss = s.squared();
153  // sss = s*ss
154  const bw6_761_Fq sss = s * ss;
155  // R = Y1*s
156  const bw6_761_Fq R = (this->Y) * s;
157  // RR = R^2
158  const bw6_761_Fq RR = R.squared();
159  // B = (X1+R)^2 - XX - RR
160  const bw6_761_Fq B = ((this->X) + R).squared() - XX - RR;
161  // h = w^2 - 2*B
162  const bw6_761_Fq h = w.squared() - (B + B);
163  // X3 = h*s
164  const bw6_761_Fq X3 = h * s;
165  // Y3 = w*(B-h) - 2*RR
166  const bw6_761_Fq Y3 = w * (B - h) - (RR + RR);
167  // Z3 = sss
168  const bw6_761_Fq Z3 = sss;
169 
170  return bw6_761_G2(X3, Y3, Z3);
171  }
172 
173  // Point addition (i.e. P + Q, P =/= Q)
174  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/projective/addition/add-1998-cmo-2
175  // Z1Z2 = Z1*Z2
176  const bw6_761_Fq Z1Z2 = (this->Z) * (other.Z);
177  // u = Y2*Z1-Y1Z2
178  const bw6_761_Fq u = Y2Z1 - Y1Z2;
179  // uu = u^2
180  const bw6_761_Fq uu = u.squared();
181  // v = X2*Z1-X1Z2
182  const bw6_761_Fq v = X2Z1 - X1Z2;
183  // vv = v^2
184  const bw6_761_Fq vv = v.squared();
185  // vvv = v*vv
186  const bw6_761_Fq vvv = v * vv;
187  // R = vv*X1Z2
188  const bw6_761_Fq R = vv * X1Z2;
189  // A = uu*Z1Z2 - vvv - 2*R
190  const bw6_761_Fq A = uu * Z1Z2 - (vvv + R + R);
191  // X3 = v*A
192  const bw6_761_Fq X3 = v * A;
193  // Y3 = u*(R-A) - vvv*Y1Z2
194  const bw6_761_Fq Y3 = u * (R - A) - vvv * Y1Z2;
195  // Z3 = vvv*Z1Z2
196  const bw6_761_Fq Z3 = vvv * Z1Z2;
197 
198  return bw6_761_G2(X3, Y3, Z3);
199 }
Here is the call graph for this function:

◆ operator-() [1/2]

bw6_761_G2 libff::bw6_761_G2::operator- ( ) const

Definition at line 201 of file bw6_761_g2.cpp.

202 {
203  return bw6_761_G2(this->X, -(this->Y), this->Z);
204 }
Here is the call graph for this function:

◆ operator-() [2/2]

bw6_761_G2 libff::bw6_761_G2::operator- ( const bw6_761_G2 other) const

Definition at line 206 of file bw6_761_g2.cpp.

207 {
208  return (*this) + (-other);
209 }

◆ operator==()

bool libff::bw6_761_G2::operator== ( const bw6_761_G2 other) const

Definition at line 89 of file bw6_761_g2.cpp.

90 {
91  if (this->is_zero()) {
92  return other.is_zero();
93  }
94 
95  if (other.is_zero()) {
96  return false;
97  }
98 
99  // Using Projective coordinates so:
100  // (X1:Y1:Z1) = (X2:Y2:Z2) <=>
101  // X1/Z1 = X2/Z2 AND Y1/Z1 = Y2/Z2 <=>
102  // X1*Z2 = X2*Z1 AND Y1*Z2 = Y2*Z1
103  if (((this->X * other.Z) != (other.X * this->Z)) ||
104  ((this->Y * other.Z) != (other.Y * this->Z))) {
105  return false;
106  }
107 
108  return true;
109 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ order()

static bigint<scalar_field::num_limbs> libff::bw6_761_G2::order ( )
inlinestatic

Definition at line 84 of file bw6_761_g2.hpp.

85  {
86  return scalar_field::field_char();
87  }
Here is the call graph for this function:

◆ print()

void libff::bw6_761_G2::print ( ) const

Definition at line 31 of file bw6_761_g2.cpp.

32 {
33  if (this->is_zero()) {
34  printf("O\n");
35  } else {
36  bw6_761_G2 copy(*this);
37  copy.to_affine_coordinates();
38  gmp_printf(
39  "(%Nd , %Nd)\n",
40  copy.X.as_bigint().data,
42  copy.Y.as_bigint().data,
44  }
45 }
Here is the call graph for this function:

◆ print_coordinates()

void libff::bw6_761_G2::print_coordinates ( ) const

Definition at line 47 of file bw6_761_g2.cpp.

48 {
49  if (this->is_zero()) {
50  printf("O\n");
51  } else {
52  gmp_printf(
53  "(%Nd : %Nd : %Nd)\n",
54  this->X.as_bigint().data,
56  this->Y.as_bigint().data,
58  this->Z.as_bigint().data,
60  }
61 }
Here is the call graph for this function:

◆ random_element()

bw6_761_G2 libff::bw6_761_G2::random_element ( )
static

Definition at line 405 of file bw6_761_g2.cpp.

406 {
407  return (bw6_761_Fr::random_element().as_bigint()) * G2_one;
408 }
Here is the call graph for this function:

◆ read_compressed()

void libff::bw6_761_G2::read_compressed ( std::istream &  in,
bw6_761_G2 g 
)
static

Definition at line 454 of file bw6_761_g2.cpp.

455 {
456  char is_zero;
457  bw6_761_Fq tX, tY;
458  // this reads is_zero;
459  in.read((char *)&is_zero, 1);
460  is_zero -= '0';
462 
463  unsigned char Y_lsb;
464  in >> tX;
466  in.read((char *)&Y_lsb, 1);
467  Y_lsb -= '0';
468 
469  // y = +/- sqrt(x^3 + a*x + b)
470  if (!is_zero) {
471  // using projective coordinates
472  const bw6_761_Fq tX2 = tX.squared();
473  const bw6_761_Fq tY2 = tX2 * tX + bw6_761_twist_coeff_b;
474  tY = tY2.sqrt();
475 
476  if ((tY.as_bigint().data[0] & 1) != Y_lsb) {
477  tY = -tY;
478  }
479 
480  g.X = tX;
481  g.Y = tY;
482  g.Z = bw6_761_Fq::one();
483  } else {
484  g = bw6_761_G2::zero();
485  }
486 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_uncompressed()

void libff::bw6_761_G2::read_uncompressed ( std::istream &  in,
bw6_761_G2 g 
)
static

Definition at line 437 of file bw6_761_g2.cpp.

438 {
439  char is_zero;
440  bw6_761_Fq tX, tY;
441  in >> is_zero >> tX >> tY;
442  is_zero -= '0';
443 
444  // using projective coordinates
445  if (!is_zero) {
446  g.X = tX;
447  g.Y = tY;
448  g.Z = bw6_761_Fq::one();
449  } else {
450  g = bw6_761_G2::zero();
451  }
452 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size_in_bits()

static size_t libff::bw6_761_G2::size_in_bits ( )
inlinestatic

Definition at line 79 of file bw6_761_g2.hpp.

79 { return twist_field::size_in_bits() + 1; }
Here is the call graph for this function:

◆ to_affine_coordinates()

void libff::bw6_761_G2::to_affine_coordinates ( )

Definition at line 63 of file bw6_761_g2.cpp.

64 {
65  if (this->is_zero()) {
66  this->X = bw6_761_Fq::zero();
67  this->Y = bw6_761_Fq::one();
68  this->Z = bw6_761_Fq::zero();
69  } else {
70  const bw6_761_Fq Z_inv = Z.inverse();
71  this->X = this->X * Z_inv;
72  this->Y = this->Y * Z_inv;
73  this->Z = bw6_761_Fq::one();
74  }
75 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_special()

void libff::bw6_761_G2::to_special ( )

Definition at line 77 of file bw6_761_g2.cpp.

77 { this->to_affine_coordinates(); }
Here is the call graph for this function:

◆ write_compressed()

void libff::bw6_761_G2::write_compressed ( std::ostream &  out) const

Definition at line 418 of file bw6_761_g2.cpp.

419 {
420  bw6_761_G2 copy(*this);
421  copy.to_affine_coordinates();
422  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
423  // storing LSB of Y
424  out << copy.X << OUTPUT_SEPARATOR << (copy.Y.as_bigint().data[0] & 1);
425 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_uncompressed()

void libff::bw6_761_G2::write_uncompressed ( std::ostream &  out) const

Definition at line 410 of file bw6_761_g2.cpp.

411 {
412  bw6_761_G2 copy(*this);
413  copy.to_affine_coordinates();
414  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
415  out << copy.X << OUTPUT_SEPARATOR << copy.Y;
416 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zero()

const bw6_761_G2 & libff::bw6_761_G2::zero ( )
static

Definition at line 401 of file bw6_761_g2.cpp.

401 { return G2_zero; }
Here is the caller graph for this function:

Member Data Documentation

◆ coeff_a

bw6_761_Fq libff::bw6_761_G2::coeff_a
static

Definition at line 26 of file bw6_761_g2.hpp.

◆ coeff_b

bw6_761_Fq libff::bw6_761_G2::coeff_b
static

Definition at line 27 of file bw6_761_g2.hpp.

◆ fixed_base_exp_window_table

std::vector< size_t > libff::bw6_761_G2::fixed_base_exp_window_table
static

Definition at line 23 of file bw6_761_g2.hpp.

◆ G2_one

bw6_761_G2 libff::bw6_761_G2::G2_one
static

Definition at line 25 of file bw6_761_g2.hpp.

◆ G2_zero

bw6_761_G2 libff::bw6_761_G2::G2_zero
static

Definition at line 24 of file bw6_761_g2.hpp.

◆ h

bigint< bw6_761_G2::h_limbs > libff::bw6_761_G2::h
static

Definition at line 37 of file bw6_761_g2.hpp.

◆ h_bitcount

const mp_size_t libff::bw6_761_G2::h_bitcount = 384
static

Definition at line 34 of file bw6_761_g2.hpp.

◆ h_limbs

const mp_size_t libff::bw6_761_G2::h_limbs
static
Initial value:
=
(h_bitcount + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS

Definition at line 35 of file bw6_761_g2.hpp.

◆ wnaf_window_table

std::vector< size_t > libff::bw6_761_G2::wnaf_window_table
static

Definition at line 22 of file bw6_761_g2.hpp.

◆ X

bw6_761_Fq libff::bw6_761_G2::X

Definition at line 39 of file bw6_761_g2.hpp.

◆ Y

bw6_761_Fq libff::bw6_761_G2::Y

Definition at line 39 of file bw6_761_g2.hpp.

◆ Z

bw6_761_Fq libff::bw6_761_G2::Z

Definition at line 39 of file bw6_761_g2.hpp.


The documentation for this class was generated from the following files:
libff::bw6_761_G2::G2_zero
static bw6_761_G2 G2_zero
Definition: bw6_761_g2.hpp:24
libff::Fp_model::random_element
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
libff::bw6_761_G2::to_affine_coordinates
void to_affine_coordinates()
Definition: bw6_761_g2.cpp:63
libff::Fp_model::squared
Fp_model squared() const
libff::bw6_761_Fq
Fp_model< bw6_761_q_limbs, bw6_761_modulus_q > bw6_761_Fq
Definition: bw6_761_init.hpp:24
libff::Fp_model< bw6_761_q_limbs, bw6_761_modulus_q >::zero
static const Fp_model< n, modulus > & zero()
libff::Fp_model::is_zero
bool is_zero() const
libff::bw6_761_G2::h_bitcount
static const mp_size_t h_bitcount
Definition: bw6_761_g2.hpp:34
libff::Fp_model::inverse
Fp_model inverse() const
libff::bw6_761_G2::one
static const bw6_761_G2 & one()
Definition: bw6_761_g2.cpp:403
libff::bw6_761_G2::base_field_char
static bigint< base_field::num_limbs > base_field_char()
Definition: bw6_761_g2.hpp:80
libff::bw6_761_G2::operator==
bool operator==(const bw6_761_G2 &other) const
Definition: bw6_761_g2.cpp:89
libff::Fp_model::sqrt
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
libff::Fp_model< bw6_761_q_limbs, bw6_761_modulus_q >::one
static const Fp_model< n, modulus > & one()
OUTPUT_SEPARATOR
#define OUTPUT_SEPARATOR
Definition: serialization.hpp:69
libff::Fp_model< bw6_761_q_limbs, bw6_761_modulus_q >::size_in_bits
static size_t size_in_bits()
Definition: fp.hpp:134
libff::consume_OUTPUT_SEPARATOR
void consume_OUTPUT_SEPARATOR(std::istream &in)
libff::Fp_model< bw6_761_q_limbs, bw6_761_modulus_q >::num_limbs
static const mp_size_t num_limbs
Definition: fp.hpp:47
libff::bw6_761_G2::G2_one
static bw6_761_G2 G2_one
Definition: bw6_761_g2.hpp:25
libff::bw6_761_G2::is_zero
bool is_zero() const
Definition: bw6_761_g2.cpp:84
libff::bw6_761_G2::zero
static const bw6_761_G2 & zero()
Definition: bw6_761_g2.cpp:401
libff::bw6_761_G2::X
bw6_761_Fq X
Definition: bw6_761_g2.hpp:39
libff::Fp_model< bw6_761_q_limbs, bw6_761_modulus_q >::field_char
static const bigint< n > & field_char()
Definition: fp.hpp:136
libff::bw6_761_G2::h
static bigint< h_limbs > h
Definition: bw6_761_g2.hpp:37
libff::Fp_model::as_bigint
bigint< n > as_bigint() const
libff::bw6_761_G2::dbl
bw6_761_G2 dbl() const
Definition: bw6_761_g2.cpp:324
libff::bw6_761_G2::Z
bw6_761_Fq Z
Definition: bw6_761_g2.hpp:39
libff::bw6_761_twist_coeff_b
bw6_761_Fq bw6_761_twist_coeff_b
Definition: bw6_761_init.cpp:19
libff::Fp_model::mod
static const constexpr bigint< n > & mod
Definition: fp.hpp:48
libff::bw6_761_G2::bw6_761_G2
bw6_761_G2()
Definition: bw6_761_g2.cpp:19
libff::bw6_761_G2::Y
bw6_761_Fq Y
Definition: bw6_761_g2.hpp:39