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_377_G1 Class Reference

#include <bls12_377_g1.hpp>

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

Public Types

typedef bls12_377_Fq base_field
 
typedef bls12_377_Fr scalar_field
 

Public Member Functions

 bls12_377_G1 ()
 
 bls12_377_G1 (const bls12_377_Fq &X, const bls12_377_Fq &Y, const bls12_377_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 bls12_377_G1 &other) const
 
bool operator!= (const bls12_377_G1 &other) const
 
bls12_377_G1 operator+ (const bls12_377_G1 &other) const
 
bls12_377_G1 operator- () const
 
bls12_377_G1 operator- (const bls12_377_G1 &other) const
 
bls12_377_G1 add (const bls12_377_G1 &other) const
 
bls12_377_G1 mixed_add (const bls12_377_G1 &other) const
 
bls12_377_G1 dbl () const
 
bls12_377_G1 mul_by_cofactor () const
 
bls12_377_G1 sigma () const
 
bool is_well_formed () const
 
bool is_in_safe_subgroup () const
 
bls12_377_G1 proof_of_safe_subgroup () const
 
void write_uncompressed (std::ostream &) const
 
void write_compressed (std::ostream &) const
 

Static Public Member Functions

static const bls12_377_G1zero ()
 
static const bls12_377_G1one ()
 
static bls12_377_G1 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 &, bls12_377_G1 &)
 
static void read_compressed (std::istream &, bls12_377_G1 &)
 
static void batch_to_special_all_non_zeros (std::vector< bls12_377_G1 > &vec)
 

Public Attributes

bls12_377_Fq X
 
bls12_377_Fq Y
 
bls12_377_Fq Z
 

Static Public Attributes

static std::vector< size_t > wnaf_window_table
 
static std::vector< size_t > fixed_base_exp_window_table
 
static bls12_377_G1 G1_zero
 
static bls12_377_G1 G1_one
 
static bls12_377_Fq coeff_a
 
static bls12_377_Fq coeff_b
 
static const mp_size_t h_bitcount = 125
 
static const mp_size_t h_limbs
 
static bigint< h_limbsh
 

Detailed Description

Definition at line 21 of file bls12_377_g1.hpp.

Member Typedef Documentation

◆ base_field

Definition at line 35 of file bls12_377_g1.hpp.

◆ scalar_field

Definition at line 36 of file bls12_377_g1.hpp.

Constructor & Destructor Documentation

◆ bls12_377_G1() [1/2]

libff::bls12_377_G1::bls12_377_G1 ( )

Definition at line 26 of file bls12_377_g1.cpp.

27 {
28  this->X = G1_zero.X;
29  this->Y = G1_zero.Y;
30  this->Z = G1_zero.Z;
31 }
Here is the caller graph for this function:

◆ bls12_377_G1() [2/2]

libff::bls12_377_G1::bls12_377_G1 ( const bls12_377_Fq X,
const bls12_377_Fq Y,
const bls12_377_Fq Z 
)
inline

Definition at line 48 of file bls12_377_g1.hpp.

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

Member Function Documentation

◆ add()

bls12_377_G1 libff::bls12_377_G1::add ( const bls12_377_G1 other) const

Definition at line 190 of file bls12_377_g1.cpp.

191 {
192  // Handle special cases having to do with O
193  if (this->is_zero()) {
194  return other;
195  }
196 
197  if (other.is_zero()) {
198  return *this;
199  }
200 
201  // No need to handle points of order 2,4
202  // (they cannot exist in a prime-order subgroup)
203 
204  // Handle double case
205  if (this->operator==(other)) {
206  return this->dbl();
207  }
208 
209 #ifdef PROFILE_OP_COUNTS
210  this->add_cnt++;
211 #endif
212  // NOTE: does not handle O and pts of order 2,4
213  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/addition/add-2007-bl
214  // Z1Z1 = Z1*Z1
215  bls12_377_Fq Z1Z1 = (this->Z).squared();
216  // Z2Z2 = Z2*Z2
217  bls12_377_Fq Z2Z2 = (other.Z).squared();
218  // U1 = X1*Z2Z2
219  bls12_377_Fq U1 = this->X * Z2Z2;
220  // U2 = X2*Z1Z1
221  bls12_377_Fq U2 = other.X * Z1Z1;
222  // S1 = Y1*Z2*Z2Z2
223  bls12_377_Fq S1 = (this->Y) * ((other.Z) * Z2Z2);
224  // S2 = Y2*Z1*Z1Z1
225  bls12_377_Fq S2 = (other.Y) * ((this->Z) * Z1Z1);
226  // H = U2-U1
227  bls12_377_Fq H = U2 - U1;
228  // I = (2*H)^2
229  bls12_377_Fq I = (H + H).squared();
230  // J = H*I
231  bls12_377_Fq J = H * I;
232  // r = 2*(S2-S1)
233  bls12_377_Fq S2_minus_S1 = S2 - S1;
234  bls12_377_Fq r = S2_minus_S1 + S2_minus_S1;
235  // V = U1*I
236  bls12_377_Fq V = U1 * I;
237  // X3 = r^2-J-2*V
238  bls12_377_Fq X3 = r.squared() - J - (V + V);
239  bls12_377_Fq S1_J = S1 * J;
240  // Y3 = r*(V-X3)-2*S1*J
241  bls12_377_Fq Y3 = r * (V - X3) - (S1_J + S1_J);
242  // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H
243  bls12_377_Fq Z3 = ((this->Z + other.Z).squared() - Z1Z1 - Z2Z2) * H;
244 
245  return bls12_377_G1(X3, Y3, Z3);
246 }
Here is the call graph for this function:

◆ base_field_char()

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

Definition at line 94 of file bls12_377_g1.hpp.

95  {
96  return base_field::field_char();
97  }
Here is the call graph for this function:

◆ batch_to_special_all_non_zeros()

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

Definition at line 512 of file bls12_377_g1.cpp.

514 {
515  std::vector<bls12_377_Fq> Z_vec;
516  Z_vec.reserve(vec.size());
517 
518  for (auto &el : vec) {
519  Z_vec.emplace_back(el.Z);
520  }
521  batch_invert<bls12_377_Fq>(Z_vec);
522 
524 
525  for (size_t i = 0; i < vec.size(); ++i) {
526  bls12_377_Fq Z2 = Z_vec[i].squared();
527  bls12_377_Fq Z3 = Z_vec[i] * Z2;
528 
529  vec[i].X = vec[i].X * Z2;
530  vec[i].Y = vec[i].Y * Z3;
531  vec[i].Z = one;
532  }
533 }
Here is the call graph for this function:

◆ dbl()

bls12_377_G1 libff::bls12_377_G1::dbl ( ) const

Definition at line 312 of file bls12_377_g1.cpp.

313 {
314 #ifdef PROFILE_OP_COUNTS
315  this->dbl_cnt++;
316 #endif
317  // Handle point at infinity
318  if (this->is_zero()) {
319  return (*this);
320  }
321 
322  // no need to handle points of order 2,4
323  // (they cannot exist in a prime-order subgroup)
324 
325  // NOTE: does not handle O and pts of order 2,4
326  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/doubling/dbl-2009-l
327  // A = X1^2
328  bls12_377_Fq A = (this->X).squared();
329  // B = Y1^2
330  bls12_377_Fq B = (this->Y).squared();
331  // C = B^2
332  bls12_377_Fq C = B.squared();
333  // D = 2 * ((X1 + B)^2 - A - C)
334  bls12_377_Fq D = (this->X + B).squared() - A - C;
335  D = D + D;
336  // E = 3 * A
337  bls12_377_Fq E = A + A + A;
338  // F = E^2
339  bls12_377_Fq F = E.squared();
340  // X3 = F - 2 D
341  bls12_377_Fq X3 = F - (D + D);
342  // Y3 = E * (D - X3) - 8 * C
343  bls12_377_Fq eightC = C + C;
344  eightC = eightC + eightC;
345  eightC = eightC + eightC;
346  bls12_377_Fq Y3 = E * (D - X3) - eightC;
347  // Z3 = 2 * Y1 * Z1
348  bls12_377_Fq Y1Z1 = (this->Y) * (this->Z);
349  bls12_377_Fq Z3 = Y1Z1 + Y1Z1;
350 
351  return bls12_377_G1(X3, Y3, Z3);
352 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_in_safe_subgroup()

bool libff::bls12_377_G1::is_in_safe_subgroup ( ) const

Definition at line 387 of file bls12_377_g1.cpp.

388 {
389  // Check that [c0]P + [c1]\sigma(P) == 0 (see bls12_377.sage), where:
390  // c0: 1
391  // c1: 91893752504881257701523279626832445441
392  // (0x452217cc900000010a11800000000001)
393  const bls12_377_G1 sigma_g = sigma();
394  const bls12_377_G1 r_times_g =
395  bls12_377_g1_safe_subgroup_check_c1 * sigma_g + *this;
396  return zero() == r_times_g;
397 }
Here is the call graph for this function:

◆ is_special()

bool libff::bls12_377_G1::is_special ( ) const

Definition at line 83 of file bls12_377_g1.cpp.

84 {
85  return (this->is_zero() || this->Z == bls12_377_Fq::one());
86 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_well_formed()

bool libff::bls12_377_G1::is_well_formed ( ) const

Definition at line 367 of file bls12_377_g1.cpp.

368 {
369  if (this->is_zero()) {
370  return true;
371  }
372 
373  // The curve equation is
374  // E': y^2 = x^3 + ax + b, where a=0
375  // We are using Jacobian coordinates. As such, the equation becomes:
376  // y^2/z^6 = x^3/z^6 + b
377  // = y^2 = x^3 + b z^6
378  bls12_377_Fq X2 = this->X.squared();
379  bls12_377_Fq Y2 = this->Y.squared();
380  bls12_377_Fq Z2 = this->Z.squared();
381  bls12_377_Fq X3 = this->X * X2;
382  bls12_377_Fq Z3 = this->Z * Z2;
383  bls12_377_Fq Z6 = Z3.squared();
384  return (Y2 == X3 + bls12_377_coeff_b * Z6);
385 }
Here is the call graph for this function:

◆ is_zero()

bool libff::bls12_377_G1::is_zero ( ) const

Definition at line 88 of file bls12_377_g1.cpp.

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

◆ mixed_add()

bls12_377_G1 libff::bls12_377_G1::mixed_add ( const bls12_377_G1 other) const

Definition at line 251 of file bls12_377_g1.cpp.

252 {
253 #ifdef DEBUG
254  assert(other.is_special());
255 #endif
256 
257  // handle special cases having to do with O
258  if (this->is_zero()) {
259  return other;
260  }
261 
262  if (other.is_zero()) {
263  return *this;
264  }
265 
266  // No need to handle points of order 2,4
267  // (they cannot exist in a prime-order subgroup)
268  // Z1Z1 = Z1*Z1
269  const bls12_377_Fq Z1Z1 = (this->Z).squared();
270  // U2 = X2*Z1Z1
271  const bls12_377_Fq U2 = other.X * Z1Z1;
272  // S2 = Y2 * Z1 * Z1Z1
273  const bls12_377_Fq S2 = (other.Y) * ((this->Z) * Z1Z1);
274 
275  // (X1/Z1^2) == X2 => X1 == X2*Z1^2
276  // (Y1/Z1^3) == Y2 => Y1 == Y2*Z1^3
277  if (this->X == U2 && this->Y == S2) {
278  return this->dbl();
279  }
280 
281 #ifdef PROFILE_OP_COUNTS
282  this->add_cnt++;
283 #endif
284 
285  // NOTE: does not handle O and pts of order 2,4
286  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/addition/madd-2007-bl
287  // H = U2-X1
288  bls12_377_Fq H = U2 - (this->X);
289  // HH = H^2
290  bls12_377_Fq HH = H.squared();
291  // I = 4*HH
292  bls12_377_Fq I = HH + HH;
293  I = I + I;
294  // J = H*I
295  bls12_377_Fq J = H * I;
296  // r = 2*(S2-Y1)
297  bls12_377_Fq r = S2 - (this->Y);
298  r = r + r;
299  // V = X1*I
300  bls12_377_Fq V = (this->X) * I;
301  // X3 = r^2-J-2*V
302  bls12_377_Fq X3 = r.squared() - J - V - V;
303  // Y3 = r*(V-X3)-2*Y1*J
304  bls12_377_Fq Y3 = (this->Y) * J;
305  Y3 = r * (V - X3) - Y3 - Y3;
306  // Z3 = (Z1+H)^2-Z1Z1-HH
307  bls12_377_Fq Z3 = ((this->Z) + H).squared() - Z1Z1 - HH;
308 
309  return bls12_377_G1(X3, Y3, Z3);
310 }
Here is the call graph for this function:

◆ mul_by_cofactor()

bls12_377_G1 libff::bls12_377_G1::mul_by_cofactor ( ) const

Definition at line 354 of file bls12_377_g1.cpp.

355 {
356  return bls12_377_G1::h * (*this);
357 }

◆ one()

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

Definition at line 413 of file bls12_377_g1.cpp.

413 { return G1_one; }
Here is the caller graph for this function:

◆ operator!=()

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

Definition at line 116 of file bls12_377_g1.cpp.

117 {
118  return !(operator==(other));
119 }
Here is the call graph for this function:

◆ operator+()

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

Definition at line 121 of file bls12_377_g1.cpp.

122 {
123  // handle special cases having to do with O
124  if (this->is_zero()) {
125  return other;
126  }
127 
128  if (other.is_zero()) {
129  return *this;
130  }
131 
132  // No need to handle points of order 2,4
133  // (they cannot exist in a prime-order subgroup)
134 
135  // Z1Z1 = Z1*Z1
136  bls12_377_Fq Z1Z1 = (this->Z).squared();
137  // Z2Z2 = Z2*Z2
138  bls12_377_Fq Z2Z2 = (other.Z).squared();
139 
140  // U1 = X1*Z2Z2
141  bls12_377_Fq U1 = this->X * Z2Z2;
142  // U2 = X2*Z1Z1
143  bls12_377_Fq U2 = other.X * Z1Z1;
144 
145  // S1 = Y1*Z2*Z2Z2
146  bls12_377_Fq S1 = (this->Y) * ((other.Z) * Z2Z2);
147  // S2 = Y2*Z1*Z1Z1
148  bls12_377_Fq S2 = (other.Y) * ((this->Z) * Z1Z1);
149 
150  // Check if the 2 points are equal, in which can we do a point doubling
151  // (i.e. P + P)
152  if (U1 == U2 && S1 == S2) {
153  return this->dbl();
154  }
155 
156  // Point addition (i.e. P + Q, P =/= Q)
157  // https://www.hyperelliptic.org/EFD/g1p/data/shortw/jacobian-0/addition/add-2007-bl
158  // H = U2-U1
159  bls12_377_Fq H = U2 - U1;
160  // I = (2*H)^2
161  bls12_377_Fq I = (H + H).squared();
162  // J = H*I
163  bls12_377_Fq J = H * I;
164  // r = 2*(S2-S1)
165  bls12_377_Fq S2_minus_S1 = S2 - S1;
166  bls12_377_Fq r = S2_minus_S1 + S2_minus_S1;
167  // V = U1*I
168  bls12_377_Fq V = U1 * I;
169  // X3 = r^2-J-2*V
170  bls12_377_Fq X3 = r.squared() - J - (V + V);
171  bls12_377_Fq S1_J = S1 * J;
172  // Y3 = r*(V-X3)-2*S1*J
173  bls12_377_Fq Y3 = r * (V - X3) - (S1_J + S1_J);
174  // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H
175  bls12_377_Fq Z3 = ((this->Z + other.Z).squared() - Z1Z1 - Z2Z2) * H;
176 
177  return bls12_377_G1(X3, Y3, Z3);
178 }
Here is the call graph for this function:

◆ operator-() [1/2]

bls12_377_G1 libff::bls12_377_G1::operator- ( ) const

Definition at line 180 of file bls12_377_g1.cpp.

181 {
182  return bls12_377_G1(this->X, -(this->Y), this->Z);
183 }
Here is the call graph for this function:

◆ operator-() [2/2]

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

Definition at line 185 of file bls12_377_g1.cpp.

186 {
187  return (*this) + (-other);
188 }

◆ operator==()

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

Definition at line 90 of file bls12_377_g1.cpp.

91 {
92  if (this->is_zero()) {
93  return other.is_zero();
94  }
95 
96  if (other.is_zero()) {
97  return false;
98  }
99 
100  // Using Jacobian coordinates so:
101  // (X1:Y1:Z1) = (X2:Y2:Z2) <=>
102  // X1/Z1^2 == X2/Z2^2 AND Y1/Z1^3 == Y2/Z2^3 <=>
103  // X1 * Z2^2 == X2 * Z1^2 and Y1 * Z2^3 == Y2 * Z1^3
104  bls12_377_Fq Z1_squared = (this->Z).squared();
105  bls12_377_Fq Z2_squared = (other.Z).squared();
106  bls12_377_Fq Z1_cubed = (this->Z) * Z1_squared;
107  bls12_377_Fq Z2_cubed = (other.Z) * Z2_squared;
108  if (((this->X * Z2_squared) != (other.X * Z1_squared)) ||
109  ((this->Y * Z2_cubed) != (other.Y * Z1_cubed))) {
110  return false;
111  }
112 
113  return true;
114 }
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_377_G1::order ( )
inlinestatic

Definition at line 98 of file bls12_377_g1.hpp.

99  {
100  return scalar_field::field_char();
101  }
Here is the call graph for this function:

◆ print()

void libff::bls12_377_G1::print ( ) const

Definition at line 33 of file bls12_377_g1.cpp.

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

◆ print_coordinates()

void libff::bls12_377_G1::print_coordinates ( ) const

Definition at line 49 of file bls12_377_g1.cpp.

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

◆ proof_of_safe_subgroup()

bls12_377_G1 libff::bls12_377_G1::proof_of_safe_subgroup ( ) const

Definition at line 399 of file bls12_377_g1.cpp.

400 {
401  // See bls12_377.sage.
402  // w = 5285428838741532253824584287042945485047145357130994810877
403 
404  return bls12_377_g1_proof_of_safe_subgroup_w * (*this) +
405  bls12_377_G1(
409 }
Here is the call graph for this function:

◆ random_element()

bls12_377_G1 libff::bls12_377_G1::random_element ( )
static

Definition at line 415 of file bls12_377_g1.cpp.

416 {
417  return (scalar_field::random_element().as_bigint()) * G1_one;
418 }
Here is the call graph for this function:

◆ read_compressed()

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

Definition at line 455 of file bls12_377_g1.cpp.

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

◆ read_uncompressed()

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

Definition at line 437 of file bls12_377_g1.cpp.

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

◆ sigma()

bls12_377_G1 libff::bls12_377_G1::sigma ( ) const

Definition at line 359 of file bls12_377_g1.cpp.

360 {
361  bls12_377_G1 result = *this;
362  result.to_affine_coordinates();
363  result.X = bls12_377_g1_endomorphism_beta * result.X;
364  return result;
365 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size_in_bits()

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

Definition at line 93 of file bls12_377_g1.hpp.

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

◆ to_affine_coordinates()

void libff::bls12_377_G1::to_affine_coordinates ( )

Definition at line 65 of file bls12_377_g1.cpp.

66 {
67  if (this->is_zero()) {
68  this->X = bls12_377_Fq::zero();
69  this->Y = bls12_377_Fq::one();
70  this->Z = bls12_377_Fq::zero();
71  } else {
72  bls12_377_Fq Z_inv = Z.inverse();
73  bls12_377_Fq Z2_inv = Z_inv.squared();
74  bls12_377_Fq Z3_inv = Z2_inv * Z_inv;
75  this->X = this->X * Z2_inv;
76  this->Y = this->Y * Z3_inv;
77  this->Z = bls12_377_Fq::one();
78  }
79 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_special()

void libff::bls12_377_G1::to_special ( )

Definition at line 81 of file bls12_377_g1.cpp.

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

◆ write_compressed()

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

Definition at line 428 of file bls12_377_g1.cpp.

429 {
430  bls12_377_G1 copy(*this);
431  copy.to_affine_coordinates();
432  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
433  /* storing LSB of Y */
434  out << copy.X << OUTPUT_SEPARATOR << (copy.Y.as_bigint().data[0] & 1);
435 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_uncompressed()

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

Definition at line 420 of file bls12_377_g1.cpp.

421 {
422  bls12_377_G1 copy(*this);
423  copy.to_affine_coordinates();
424  out << (copy.is_zero() ? 1 : 0) << OUTPUT_SEPARATOR;
425  out << copy.X << OUTPUT_SEPARATOR << copy.Y;
426 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zero()

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

Definition at line 411 of file bls12_377_g1.cpp.

411 { return G1_zero; }
Here is the caller graph for this function:

Member Data Documentation

◆ coeff_a

bls12_377_Fq libff::bls12_377_G1::coeff_a
static

Definition at line 32 of file bls12_377_g1.hpp.

◆ coeff_b

bls12_377_Fq libff::bls12_377_G1::coeff_b
static

Definition at line 33 of file bls12_377_g1.hpp.

◆ fixed_base_exp_window_table

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

Definition at line 29 of file bls12_377_g1.hpp.

◆ G1_one

bls12_377_G1 libff::bls12_377_G1::G1_one
static

Definition at line 31 of file bls12_377_g1.hpp.

◆ G1_zero

bls12_377_G1 libff::bls12_377_G1::G1_zero
static

Definition at line 30 of file bls12_377_g1.hpp.

◆ h

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

Definition at line 42 of file bls12_377_g1.hpp.

◆ h_bitcount

const mp_size_t libff::bls12_377_G1::h_bitcount = 125
static

Definition at line 39 of file bls12_377_g1.hpp.

◆ h_limbs

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

Definition at line 40 of file bls12_377_g1.hpp.

◆ wnaf_window_table

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

Definition at line 28 of file bls12_377_g1.hpp.

◆ X

bls12_377_Fq libff::bls12_377_G1::X

Definition at line 44 of file bls12_377_g1.hpp.

◆ Y

bls12_377_Fq libff::bls12_377_G1::Y

Definition at line 44 of file bls12_377_g1.hpp.

◆ Z

bls12_377_Fq libff::bls12_377_G1::Z

Definition at line 44 of file bls12_377_g1.hpp.


The documentation for this class was generated from the following files:
libff::bls12_377_G1::G1_zero
static bls12_377_G1 G1_zero
Definition: bls12_377_g1.hpp:30
libff::Fp_model::random_element
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
libff::Fp_model::squared
Fp_model squared() const
libff::bls12_377_G1::zero
static const bls12_377_G1 & zero()
Definition: bls12_377_g1.cpp:411
libff::bls12_377_G1::sigma
bls12_377_G1 sigma() const
Definition: bls12_377_g1.cpp:359
libff::Fp_model< bls12_377_q_limbs, bls12_377_modulus_q >::zero
static const Fp_model< n, modulus > & zero()
libff::Fp_model::is_zero
bool is_zero() const
libff::bls12_377_G1::Z
bls12_377_Fq Z
Definition: bls12_377_g1.hpp:44
libff::bls12_377_coeff_b
bls12_377_Fq bls12_377_coeff_b
Definition: bls12_377_init.cpp:16
libff::bls12_377_Fq
Fp_model< bls12_377_q_limbs, bls12_377_modulus_q > bls12_377_Fq
Definition: bls12_377_init.hpp:48
libff::Fp_model::inverse
Fp_model inverse() const
libff::bls12_377_g1_safe_subgroup_check_c1
bigint< bls12_377_r_limbs > bls12_377_g1_safe_subgroup_check_c1
Definition: bls12_377_init.cpp:27
libff::bls12_377_G1::operator==
bool operator==(const bls12_377_G1 &other) const
Definition: bls12_377_g1.cpp:90
libff::Fp_model::sqrt
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
libff::Fp_model< bls12_377_q_limbs, bls12_377_modulus_q >::one
static const Fp_model< n, modulus > & one()
libff::bls12_377_g1_proof_of_safe_subgroup_non_member_y
bls12_377_Fq bls12_377_g1_proof_of_safe_subgroup_non_member_y
Definition: bls12_377_init.cpp:30
OUTPUT_SEPARATOR
#define OUTPUT_SEPARATOR
Definition: serialization.hpp:69
libff::bls12_377_G1::to_affine_coordinates
void to_affine_coordinates()
Definition: bls12_377_g1.cpp:65
libff::bls12_377_g1_proof_of_safe_subgroup_non_member_x
bls12_377_Fq bls12_377_g1_proof_of_safe_subgroup_non_member_x
Definition: bls12_377_init.cpp:29
libff::Fp_model< bls12_377_q_limbs, bls12_377_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< bls12_377_q_limbs, bls12_377_modulus_q >::num_limbs
static const mp_size_t num_limbs
Definition: fp.hpp:47
libff::bls12_377_g1_proof_of_safe_subgroup_w
bigint< bls12_377_r_limbs > bls12_377_g1_proof_of_safe_subgroup_w
Definition: bls12_377_init.cpp:28
libff::Fp_model< bls12_377_q_limbs, bls12_377_modulus_q >::field_char
static const bigint< n > & field_char()
Definition: fp.hpp:136
libff::Fp_model::as_bigint
bigint< n > as_bigint() const
libff::bls12_377_G1::X
bls12_377_Fq X
Definition: bls12_377_g1.hpp:44
libff::bls12_377_G1::one
static const bls12_377_G1 & one()
Definition: bls12_377_g1.cpp:413
libff::bls12_377_G1::bls12_377_G1
bls12_377_G1()
Definition: bls12_377_g1.cpp:26
libff::bls12_377_G1::G1_one
static bls12_377_G1 G1_one
Definition: bls12_377_g1.hpp:31
libff::bls12_377_G1::Y
bls12_377_Fq Y
Definition: bls12_377_g1.hpp:44
libff::bls12_377_G1::is_zero
bool is_zero() const
Definition: bls12_377_g1.cpp:88
libff::bls12_377_G1::h_bitcount
static const mp_size_t h_bitcount
Definition: bls12_377_g1.hpp:39
libff::bls12_377_G1::h
static bigint< h_limbs > h
Definition: bls12_377_g1.hpp:42
libff::bls12_377_G1::dbl
bls12_377_G1 dbl() const
Definition: bls12_377_g1.cpp:312
libff::bls12_377_g1_endomorphism_beta
bls12_377_Fq bls12_377_g1_endomorphism_beta
Definition: bls12_377_init.cpp:26