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::bls12_381_G2 Class Reference

#include <bls12_381_g2.hpp>

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

Public Types

typedef bls12_381_Fq base_field
 
typedef bls12_381_Fq2 twist_field
 
typedef bls12_381_Fr scalar_field
 

Public Member Functions

 bls12_381_G2 ()
 
 bls12_381_G2 (const bls12_381_Fq2 &X, const bls12_381_Fq2 &Y, const bls12_381_Fq2 &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 bls12_381_G2 &other) const
 
bool operator!= (const bls12_381_G2 &other) const
 
bls12_381_G2 operator+ (const bls12_381_G2 &other) const
 
bls12_381_G2 operator- () const
 
bls12_381_G2 operator- (const bls12_381_G2 &other) const
 
bls12_381_G2 add (const bls12_381_G2 &other) const
 
bls12_381_G2 mixed_add (const bls12_381_G2 &other) const
 
bls12_381_G2 dbl () const
 
bls12_381_G2 mul_by_q () const
 
bls12_381_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 bls12_381_Fq2 mul_by_b (const bls12_381_Fq2 &elt)
 
static const bls12_381_G2zero ()
 
static const bls12_381_G2one ()
 
static bls12_381_G2 random_element ()
 
static std::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 &, bls12_381_G2 &)
 
static void read_compressed (std::istream &, bls12_381_G2 &)
 
static void batch_to_special_all_non_zeros (std::vector< bls12_381_G2 > &vec)
 

Public Attributes

bls12_381_Fq2 X
 
bls12_381_Fq2 Y
 
bls12_381_Fq2 Z
 

Static Public Attributes

static std::vector< std::size_t > wnaf_window_table
 
static std::vector< std::size_t > fixed_base_exp_window_table
 
static bls12_381_G2 G2_zero
 
static bls12_381_G2 G2_one
 
static bls12_381_Fq2 coeff_a
 
static bls12_381_Fq2 coeff_b
 
static const mp_size_t h_bitcount = 507
 
static const mp_size_t h_limbs
 
static bigint< h_limbsh
 

Detailed Description

Definition at line 21 of file bls12_381_g2.hpp.

Member Typedef Documentation

◆ base_field

Definition at line 35 of file bls12_381_g2.hpp.

◆ scalar_field

Definition at line 37 of file bls12_381_g2.hpp.

◆ twist_field

Definition at line 36 of file bls12_381_g2.hpp.

Constructor & Destructor Documentation

◆ bls12_381_G2() [1/2]

libff::bls12_381_G2::bls12_381_G2 ( )

Definition at line 19 of file bls12_381_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:

◆ bls12_381_G2() [2/2]

libff::bls12_381_G2::bls12_381_G2 ( const bls12_381_Fq2 X,
const bls12_381_Fq2 Y,
const bls12_381_Fq2 Z 
)
inline

Definition at line 49 of file bls12_381_g2.hpp.

51  : X(X), Y(Y), Z(Z){};

Member Function Documentation

◆ add()

bls12_381_G2 libff::bls12_381_G2::add ( const bls12_381_G2 other) const

Definition at line 209 of file bls12_381_g2.cpp.

210 {
211  return (*this) + other;
212 }

◆ base_field_char()

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

Definition at line 88 of file bls12_381_g2.hpp.

89  {
90  return base_field::field_char();
91  }
Here is the call graph for this function:

◆ batch_to_special_all_non_zeros()

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

Definition at line 463 of file bls12_381_g2.cpp.

465 {
466  std::vector<bls12_381_Fq2> Z_vec;
467  Z_vec.reserve(vec.size());
468 
469  for (auto &el : vec) {
470  Z_vec.emplace_back(el.Z);
471  }
472  batch_invert<bls12_381_Fq2>(Z_vec);
473 
475 
476  for (size_t i = 0; i < vec.size(); ++i) {
477  bls12_381_Fq2 Z2 = Z_vec[i].squared();
478  bls12_381_Fq2 Z3 = Z_vec[i] * Z2;
479 
480  vec[i].X = vec[i].X * Z2;
481  vec[i].Y = vec[i].Y * Z3;
482  vec[i].Z = one;
483  }
484 }
Here is the call graph for this function:

◆ dbl()

bls12_381_G2 libff::bls12_381_G2::dbl ( ) const

Definition at line 283 of file bls12_381_g2.cpp.

284 {
285 #ifdef PROFILE_OP_COUNTS
286  this->dbl_cnt++;
287 #endif
288  // handle point at infinity
289  if (this->is_zero()) {
290  return (*this);
291  }
292 
293  // NOTE: does not handle O and pts of order 2,4
294  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/doubling/dbl-2009-l
295 
296  // A = X1^2
297  bls12_381_Fq2 A = (this->X).squared();
298  // B = Y1^2
299  bls12_381_Fq2 B = (this->Y).squared();
300  // C = B^2
301  bls12_381_Fq2 C = B.squared();
302  bls12_381_Fq2 D = (this->X + B).squared() - A - C;
303  // D = 2 * ((X1 + B)^2 - A - C)
304  D = D + D;
305  // E = 3 * A
306  bls12_381_Fq2 E = A + A + A;
307  // F = E^2
308  bls12_381_Fq2 F = E.squared();
309  // X3 = F - 2 D
310  bls12_381_Fq2 X3 = F - (D + D);
311  bls12_381_Fq2 eightC = C + C;
312  eightC = eightC + eightC;
313  eightC = eightC + eightC;
314  // Y3 = E * (D - X3) - 8 * C
315  bls12_381_Fq2 Y3 = E * (D - X3) - eightC;
316  bls12_381_Fq2 Y1Z1 = (this->Y) * (this->Z);
317  // Z3 = 2 * Y1 * Z1
318  bls12_381_Fq2 Z3 = Y1Z1 + Y1Z1;
319 
320  return bls12_381_G2(X3, Y3, Z3);
321 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_in_safe_subgroup()

bool libff::bls12_381_G2::is_in_safe_subgroup ( ) const

Definition at line 362 of file bls12_381_g2.cpp.

363 {
364  return zero() == scalar_field::mod * (*this);
365 }
Here is the call graph for this function:

◆ is_special()

bool libff::bls12_381_G2::is_special ( ) const

Definition at line 93 of file bls12_381_g2.cpp.

94 {
95  return (this->is_zero() || this->Z == bls12_381_Fq2::one());
96 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_well_formed()

bool libff::bls12_381_G2::is_well_formed ( ) const

Definition at line 336 of file bls12_381_g2.cpp.

337 {
338  if (this->is_zero()) {
339  return true;
340  }
341  /*
342  y^2 = x^3 + b
343 
344  We are using Jacobian coordinates, so equation we need to check is
345  actually
346 
347  (y/z^3)^2 = (x/z^2)^3 + b
348  y^2 / z^6 = x^3 / z^6 + b
349  y^2 = x^3 + b z^6
350  */
351  bls12_381_Fq2 X2 = this->X.squared();
352  bls12_381_Fq2 Y2 = this->Y.squared();
353  bls12_381_Fq2 Z2 = this->Z.squared();
354 
355  bls12_381_Fq2 X3 = this->X * X2;
356  bls12_381_Fq2 Z3 = this->Z * Z2;
357  bls12_381_Fq2 Z6 = Z3.squared();
358 
359  return (Y2 == X3 + bls12_381_twist_coeff_b * Z6);
360 }
Here is the call graph for this function:

◆ is_zero()

bool libff::bls12_381_G2::is_zero ( ) const

Definition at line 98 of file bls12_381_g2.cpp.

98 { return (this->Z.is_zero()); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mixed_add()

bls12_381_G2 libff::bls12_381_G2::mixed_add ( const bls12_381_G2 other) const

Definition at line 214 of file bls12_381_g2.cpp.

215 {
216 #ifdef DEBUG
217  assert(other.is_special());
218 #endif
219 
220  // handle special cases having to do with O
221  if (this->is_zero()) {
222  return other;
223  }
224 
225  if (other.is_zero()) {
226  return *this;
227  }
228 
229  // no need to handle points of order 2,4
230  // (they cannot exist in a prime-order subgroup)
231 
232  // check for doubling case
233 
234  // using Jacobian coordinates so:
235  // (X1:Y1:Z1) = (X2:Y2:Z2)
236  // iff
237  // X1/Z1^2 == X2/Z2^2 and Y1/Z1^3 == Y2/Z2^3
238  // iff
239  // X1 * Z2^2 == X2 * Z1^2 and Y1 * Z2^3 == Y2 * Z1^3
240 
241  // we know that Z2 = 1
242 
243  const bls12_381_Fq2 Z1Z1 = (this->Z).squared();
244  const bls12_381_Fq2 U2 = other.X * Z1Z1;
245  const bls12_381_Fq2 S2 = (other.Y) * ((this->Z) * Z1Z1);
246 
247  if (this->X == U2 && this->Y == S2) {
248  // dbl case; nothing of above can be reused
249  return this->dbl();
250  }
251 
252 #ifdef PROFILE_OP_COUNTS
253  this->add_cnt++;
254 #endif
255 
256  // NOTE: does not handle O and pts of order 2,4
257  // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl
258  // H = U2-X1
259  bls12_381_Fq2 H = U2 - (this->X);
260  // HH = H&2
261  bls12_381_Fq2 HH = H.squared();
262  // I = 4*HH
263  bls12_381_Fq2 I = HH + HH;
264  I = I + I;
265  // J = H*I
266  bls12_381_Fq2 J = H * I;
267  // r = 2*(S2-Y1)
268  bls12_381_Fq2 r = S2 - (this->Y);
269  r = r + r;
270  // V = X1*I
271  bls12_381_Fq2 V = (this->X) * I;
272  // X3 = r^2-J-2*V
273  bls12_381_Fq2 X3 = r.squared() - J - V - V;
274  // Y3 = r*(V-X3)-2*Y1*J
275  bls12_381_Fq2 Y3 = (this->Y) * J;
276  Y3 = r * (V - X3) - Y3 - Y3;
277  // Z3 = (Z1+H)^2-Z1Z1-HH
278  bls12_381_Fq2 Z3 = ((this->Z) + H).squared() - Z1Z1 - HH;
279 
280  return bls12_381_G2(X3, Y3, Z3);
281 }
Here is the call graph for this function:

◆ mul_by_b()

bls12_381_Fq2 libff::bls12_381_G2::mul_by_b ( const bls12_381_Fq2 elt)
static

Definition at line 26 of file bls12_381_g2.cpp.

27 {
28  return bls12_381_Fq2(
29  bls12_381_twist_mul_by_b_c0 * elt.coeffs[0],
30  bls12_381_twist_mul_by_b_c1 * elt.coeffs[1]);
31 }

◆ mul_by_cofactor()

bls12_381_G2 libff::bls12_381_G2::mul_by_cofactor ( ) const

Definition at line 331 of file bls12_381_g2.cpp.

332 {
333  return bls12_381_G2::h * (*this);
334 }

◆ mul_by_q()

bls12_381_G2 libff::bls12_381_G2::mul_by_q ( ) const

Definition at line 323 of file bls12_381_g2.cpp.

324 {
325  return bls12_381_G2(
326  bls12_381_twist_mul_by_q_X * (this->X).Frobenius_map(1),
327  bls12_381_twist_mul_by_q_Y * (this->Y).Frobenius_map(1),
328  (this->Z).Frobenius_map(1));
329 }
Here is the call graph for this function:

◆ one()

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

Definition at line 369 of file bls12_381_g2.cpp.

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

◆ operator!=()

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

Definition at line 131 of file bls12_381_g2.cpp.

132 {
133  return !(operator==(other));
134 }
Here is the call graph for this function:

◆ operator+()

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

Definition at line 136 of file bls12_381_g2.cpp.

137 {
138  // handle special cases having to do with O
139  if (this->is_zero()) {
140  return other;
141  }
142 
143  if (other.is_zero()) {
144  return *this;
145  }
146 
147  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/addition/add-2007-bl
148  // no need to handle points of order 2,4
149  // (they cannot exist in a prime-order subgroup)
150 
151  // check for doubling case
152 
153  // using Jacobian coordinates so:
154  // (X1:Y1:Z1) = (X2:Y2:Z2)
155  // iff
156  // X1/Z1^2 == X2/Z2^2 and Y1/Z1^3 == Y2/Z2^3
157  // iff
158  // X1 * Z2^2 == X2 * Z1^2 and Y1 * Z2^3 == Y2 * Z1^3
159 
160  bls12_381_Fq2 Z1Z1 = (this->Z).squared();
161  bls12_381_Fq2 Z2Z2 = (other.Z).squared();
162 
163  bls12_381_Fq2 U1 = this->X * Z2Z2;
164  bls12_381_Fq2 U2 = other.X * Z1Z1;
165 
166  // S1 = Y1*Z2*Z2Z2
167  bls12_381_Fq2 S1 = (this->Y) * ((other.Z) * Z2Z2);
168  // S2 = Y2*Z1*Z1Z1
169  bls12_381_Fq2 S2 = (other.Y) * ((this->Z) * Z1Z1);
170 
171  if (U1 == U2 && S1 == S2) {
172  // dbl case; nothing of above can be reused
173  return this->dbl();
174  }
175 
176  // rest of add case
177  // H = U2-U1
178  bls12_381_Fq2 H = U2 - U1;
179  // I = (2 * H)^2
180  bls12_381_Fq2 I = (H + H).squared();
181  // J = H * I
182  bls12_381_Fq2 J = H * I;
183  // r = 2 * (S2-S1)
184  bls12_381_Fq2 S2_minus_S1 = S2 - S1;
185  bls12_381_Fq2 r = S2_minus_S1 + S2_minus_S1;
186  // V = U1 * I
187  bls12_381_Fq2 V = U1 * I;
188  // X3 = r^2 - J - 2 * V
189  bls12_381_Fq2 X3 = r.squared() - J - (V + V);
190  bls12_381_Fq2 S1_J = S1 * J;
191  // Y3 = r * (V-X3)-2 S1 J
192  bls12_381_Fq2 Y3 = r * (V - X3) - (S1_J + S1_J);
193  // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H
194  bls12_381_Fq2 Z3 = ((this->Z + other.Z).squared() - Z1Z1 - Z2Z2) * H;
195 
196  return bls12_381_G2(X3, Y3, Z3);
197 }
Here is the call graph for this function:

◆ operator-() [1/2]

bls12_381_G2 libff::bls12_381_G2::operator- ( ) const

Definition at line 199 of file bls12_381_g2.cpp.

200 {
201  return bls12_381_G2(this->X, -(this->Y), this->Z);
202 }
Here is the call graph for this function:

◆ operator-() [2/2]

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

Definition at line 204 of file bls12_381_g2.cpp.

205 {
206  return (*this) + (-other);
207 }

◆ operator==()

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

Definition at line 100 of file bls12_381_g2.cpp.

101 {
102  if (this->is_zero()) {
103  return other.is_zero();
104  }
105 
106  if (other.is_zero()) {
107  return false;
108  }
109 
110  /* now neither is O */
111 
112  // using Jacobian coordinates so:
113  // (X1:Y1:Z1) = (X2:Y2:Z2)
114  // iff
115  // X1/Z1^2 == X2/Z2^2 and Y1/Z1^3 == Y2/Z2^3
116  // iff
117  // X1 * Z2^2 == X2 * Z1^2 and Y1 * Z2^3 == Y2 * Z1^3
118 
119  bls12_381_Fq2 Z1_squared = (this->Z).squared();
120  bls12_381_Fq2 Z2_squared = (other.Z).squared();
121  bls12_381_Fq2 Z1_cubed = (this->Z) * Z1_squared;
122  bls12_381_Fq2 Z2_cubed = (other.Z) * Z2_squared;
123  if (((this->X * Z2_squared) != (other.X * Z1_squared)) ||
124  ((this->Y * Z2_cubed) != (other.Y * Z1_cubed))) {
125  return false;
126  }
127 
128  return true;
129 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ order()

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

Definition at line 92 of file bls12_381_g2.hpp.

93  {
94  return scalar_field::field_char();
95  }
Here is the call graph for this function:

◆ print()

void libff::bls12_381_G2::print ( ) const

Definition at line 33 of file bls12_381_g2.cpp.

34 {
35  if (this->is_zero()) {
36  printf("O\n");
37  } else {
38  bls12_381_G2 copy(*this);
39  copy.to_affine_coordinates();
40  gmp_printf(
41  "(%Nd*z + %Nd , %Nd*z + %Nd)\n",
42  copy.X.coeffs[1].as_bigint().data,
44  copy.X.coeffs[0].as_bigint().data,
46  copy.Y.coeffs[1].as_bigint().data,
48  copy.Y.coeffs[0].as_bigint().data,
50  }
51 }
Here is the call graph for this function:

◆ print_coordinates()

void libff::bls12_381_G2::print_coordinates ( ) const

Definition at line 53 of file bls12_381_g2.cpp.

54 {
55  if (this->is_zero()) {
56  printf("O\n");
57  } else {
58  gmp_printf(
59  "(%Nd*z + %Nd : %Nd*z + %Nd : %Nd*z + %Nd)\n",
60  this->X.coeffs[1].as_bigint().data,
62  this->X.coeffs[0].as_bigint().data,
64  this->Y.coeffs[1].as_bigint().data,
66  this->Y.coeffs[0].as_bigint().data,
68  this->Z.coeffs[1].as_bigint().data,
70  this->Z.coeffs[0].as_bigint().data,
72  }
73 }
Here is the call graph for this function:

◆ random_element()

bls12_381_G2 libff::bls12_381_G2::random_element ( )
static

Definition at line 371 of file bls12_381_g2.cpp.

372 {
373  return (bls12_381_Fr::random_element().as_bigint()) * G2_one;
374 }
Here is the call graph for this function:

◆ read_compressed()

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

Definition at line 410 of file bls12_381_g2.cpp.

411 {
412  char is_zero;
413  bls12_381_Fq2 tX, tY;
414  // this reads is_zero;
415  in.read((char *)&is_zero, 1);
416  is_zero -= '0';
418 
419  unsigned char Y_lsb;
420  in >> tX;
422  in.read((char *)&Y_lsb, 1);
423  Y_lsb -= '0';
424 
425  // y = +/- sqrt(x^3 + b)
426  if (!is_zero) {
427  bls12_381_Fq2 tX2 = tX.squared();
428  bls12_381_Fq2 tY2 = tX2 * tX + bls12_381_twist_coeff_b;
429  tY = tY2.sqrt();
430 
431  if ((tY.coeffs[0].as_bigint().data[0] & 1) != Y_lsb) {
432  tY = -tY;
433  }
434 
435  g.X = tX;
436  g.Y = tY;
437  g.Z = bls12_381_Fq2::one();
438  } else {
439  g = bls12_381_G2::zero();
440  }
441 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_uncompressed()

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

Definition at line 394 of file bls12_381_g2.cpp.

395 {
396  char is_zero;
397  bls12_381_Fq2 tX, tY;
398  in >> is_zero >> tX >> tY;
399  is_zero -= '0';
400 
401  if (!is_zero) {
402  g.X = tX;
403  g.Y = tY;
404  g.Z = bls12_381_Fq2::one();
405  } else {
406  g = bls12_381_G2::zero();
407  }
408 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size_in_bits()

static std::size_t libff::bls12_381_G2::size_in_bits ( )
inlinestatic

Definition at line 84 of file bls12_381_g2.hpp.

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

◆ to_affine_coordinates()

void libff::bls12_381_G2::to_affine_coordinates ( )

Definition at line 75 of file bls12_381_g2.cpp.

76 {
77  if (this->is_zero()) {
78  this->X = bls12_381_Fq2::zero();
79  this->Y = bls12_381_Fq2::one();
80  this->Z = bls12_381_Fq2::zero();
81  } else {
82  bls12_381_Fq2 Z_inv = Z.inverse();
83  bls12_381_Fq2 Z2_inv = Z_inv.squared();
84  bls12_381_Fq2 Z3_inv = Z2_inv * Z_inv;
85  this->X = this->X * Z2_inv;
86  this->Y = this->Y * Z3_inv;
87  this->Z = bls12_381_Fq2::one();
88  }
89 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_special()

void libff::bls12_381_G2::to_special ( )

Definition at line 91 of file bls12_381_g2.cpp.

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

◆ write_compressed()

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

Definition at line 384 of file bls12_381_g2.cpp.

385 {
386  bls12_381_G2 copy(*this);
387  copy.to_affine_coordinates();
388  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
389  /* storing LSB of Y */
390  out << copy.X << OUTPUT_SEPARATOR
391  << (copy.Y.coeffs[0].as_bigint().data[0] & 1);
392 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_uncompressed()

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

Definition at line 376 of file bls12_381_g2.cpp.

377 {
378  bls12_381_G2 copy(*this);
379  copy.to_affine_coordinates();
380  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
381  out << copy.X << OUTPUT_SEPARATOR << copy.Y;
382 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zero()

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

Definition at line 367 of file bls12_381_g2.cpp.

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

Member Data Documentation

◆ coeff_a

bls12_381_Fq2 libff::bls12_381_G2::coeff_a
static

Definition at line 32 of file bls12_381_g2.hpp.

◆ coeff_b

bls12_381_Fq2 libff::bls12_381_G2::coeff_b
static

Definition at line 33 of file bls12_381_g2.hpp.

◆ fixed_base_exp_window_table

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

Definition at line 29 of file bls12_381_g2.hpp.

◆ G2_one

bls12_381_G2 libff::bls12_381_G2::G2_one
static

Definition at line 31 of file bls12_381_g2.hpp.

◆ G2_zero

bls12_381_G2 libff::bls12_381_G2::G2_zero
static

Definition at line 30 of file bls12_381_g2.hpp.

◆ h

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

Definition at line 43 of file bls12_381_g2.hpp.

◆ h_bitcount

const mp_size_t libff::bls12_381_G2::h_bitcount = 507
static

Definition at line 40 of file bls12_381_g2.hpp.

◆ h_limbs

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

Definition at line 41 of file bls12_381_g2.hpp.

◆ wnaf_window_table

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

Definition at line 28 of file bls12_381_g2.hpp.

◆ X

bls12_381_Fq2 libff::bls12_381_G2::X

Definition at line 45 of file bls12_381_g2.hpp.

◆ Y

bls12_381_Fq2 libff::bls12_381_G2::Y

Definition at line 45 of file bls12_381_g2.hpp.

◆ Z

bls12_381_Fq2 libff::bls12_381_G2::Z

Definition at line 45 of file bls12_381_g2.hpp.


The documentation for this class was generated from the following files:
libff::Fp2_model::coeffs
my_Fp coeffs[2]
Definition: fp2.hpp:63
libff::bls12_381_G2::one
static const bls12_381_G2 & one()
Definition: bls12_381_g2.cpp:369
libff::bls12_381_twist_mul_by_b_c1
bls12_381_Fq bls12_381_twist_mul_by_b_c1
Definition: bls12_381_init.cpp:16
libff::Fp_model::random_element
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
libff::Fp2_model< bls12_381_q_limbs, bls12_381_modulus_q >::one
static const Fp2_model< n, modulus > & one()
libff::bls12_381_twist_coeff_b
bls12_381_Fq2 bls12_381_twist_coeff_b
Definition: bls12_381_init.cpp:14
libff::bls12_381_Fq2
Fp2_model< bls12_381_q_limbs, bls12_381_modulus_q > bls12_381_Fq2
Definition: bls12_381_init.hpp:32
libff::bls12_381_G2::h
static bigint< h_limbs > h
Definition: bls12_381_g2.hpp:43
libff::Fp2_model< bls12_381_q_limbs, bls12_381_modulus_q >::size_in_bits
static size_t size_in_bits()
Definition: fp2.hpp:108
libff::bls12_381_twist_mul_by_q_X
bls12_381_Fq2 bls12_381_twist_mul_by_q_X
Definition: bls12_381_init.cpp:17
libff::bls12_381_G2::dbl
bls12_381_G2 dbl() const
Definition: bls12_381_g2.cpp:283
libff::bls12_381_twist_mul_by_q_Y
bls12_381_Fq2 bls12_381_twist_mul_by_q_Y
Definition: bls12_381_init.cpp:18
libff::bls12_381_G2::Y
bls12_381_Fq2 Y
Definition: bls12_381_g2.hpp:45
libff::bls12_381_G2::G2_one
static bls12_381_G2 G2_one
Definition: bls12_381_g2.hpp:31
libff::bls12_381_G2::bls12_381_G2
bls12_381_G2()
Definition: bls12_381_g2.cpp:19
libff::Fp2_model::inverse
Fp2_model inverse() const
OUTPUT_SEPARATOR
#define OUTPUT_SEPARATOR
Definition: serialization.hpp:69
libff::Fp2_model::is_zero
bool is_zero() const
Definition: fp2.hpp:89
libff::bls12_381_twist_mul_by_b_c0
bls12_381_Fq bls12_381_twist_mul_by_b_c0
Definition: bls12_381_init.cpp:15
libff::bls12_381_G2::zero
static const bls12_381_G2 & zero()
Definition: bls12_381_g2.cpp:367
libff::consume_OUTPUT_SEPARATOR
void consume_OUTPUT_SEPARATOR(std::istream &in)
libff::Fp_model< bls12_381_q_limbs, bls12_381_modulus_q >::num_limbs
static const mp_size_t num_limbs
Definition: fp.hpp:47
libff::bls12_381_G2::operator==
bool operator==(const bls12_381_G2 &other) const
Definition: bls12_381_g2.cpp:100
libff::bls12_381_G2::G2_zero
static bls12_381_G2 G2_zero
Definition: bls12_381_g2.hpp:30
libff::Fp_model< bls12_381_q_limbs, bls12_381_modulus_q >::field_char
static const bigint< n > & field_char()
Definition: fp.hpp:136
libff::bls12_381_G2::h_bitcount
static const mp_size_t h_bitcount
Definition: bls12_381_g2.hpp:40
libff::Fp_model::as_bigint
bigint< n > as_bigint() const
libff::Fp2_model::squared
Fp2_model squared() const
default is squared_complex
libff::Fp_model::mod
static const constexpr bigint< n > & mod
Definition: fp.hpp:48
libff::Fp2_model::sqrt
Fp2_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
libff::bls12_381_G2::X
bls12_381_Fq2 X
Definition: bls12_381_g2.hpp:45
libff::Fp2_model< bls12_381_q_limbs, bls12_381_modulus_q >::zero
static const Fp2_model< n, modulus > & zero()
libff::bls12_381_G2::Z
bls12_381_Fq2 Z
Definition: bls12_381_g2.hpp:45
libff::bls12_381_G2::is_zero
bool is_zero() const
Definition: bls12_381_g2.cpp:98
libff::bls12_381_G2::to_affine_coordinates
void to_affine_coordinates()
Definition: bls12_381_g2.cpp:75