Clearmatics Libff  0.1
C++ library for Finite Fields and Elliptic Curves
bls12_377_pairing.cpp
Go to the documentation of this file.
1 #include <cassert>
7 
8 namespace libff
9 {
10 
12  const bls12_377_ate_G1_precomp &other) const
13 {
14  return (this->PX == other.PX && this->PY == other.PY);
15 }
16 
17 std::ostream &operator<<(
18  std::ostream &out, const bls12_377_ate_G1_precomp &prec_P)
19 {
20  out << prec_P.PX << OUTPUT_SEPARATOR << prec_P.PY;
21 
22  return out;
23 }
24 
25 std::istream &operator>>(std::istream &in, bls12_377_ate_G1_precomp &prec_P)
26 {
27  in >> prec_P.PX;
29  in >> prec_P.PY;
30 
31  return in;
32 }
33 
35  const bls12_377_ate_ell_coeffs &other) const
36 {
37  return (
38  this->ell_0 == other.ell_0 && this->ell_VW == other.ell_VW &&
39  this->ell_VV == other.ell_VV);
40 }
41 
42 std::ostream &operator<<(std::ostream &out, const bls12_377_ate_ell_coeffs &c)
43 {
44  out << c.ell_0 << OUTPUT_SEPARATOR << c.ell_VW << OUTPUT_SEPARATOR
45  << c.ell_VV;
46  return out;
47 }
48 
49 std::istream &operator>>(std::istream &in, bls12_377_ate_ell_coeffs &c)
50 {
51  in >> c.ell_0;
53  in >> c.ell_VW;
55  in >> c.ell_VV;
56 
57  return in;
58 }
59 
61  const bls12_377_ate_G2_precomp &other) const
62 {
63  return (
64  this->QX == other.QX && this->QY == other.QY &&
65  this->coeffs == other.coeffs);
66 }
67 
68 std::ostream &operator<<(
69  std::ostream &out, const bls12_377_ate_G2_precomp &prec_Q)
70 {
71  out << prec_Q.QX << OUTPUT_SEPARATOR << prec_Q.QY << "\n";
72  out << prec_Q.coeffs.size() << "\n";
73  for (const bls12_377_ate_ell_coeffs &c : prec_Q.coeffs) {
74  out << c << OUTPUT_NEWLINE;
75  }
76  return out;
77 }
78 
79 std::istream &operator>>(std::istream &in, bls12_377_ate_G2_precomp &prec_Q)
80 {
81  in >> prec_Q.QX;
83  in >> prec_Q.QY;
84  consume_newline(in);
85 
86  prec_Q.coeffs.clear();
87  size_t s;
88  in >> s;
89 
90  consume_newline(in);
91 
92  prec_Q.coeffs.reserve(s);
93 
94  for (size_t i = 0; i < s; ++i) {
96  in >> c;
98  prec_Q.coeffs.emplace_back(c);
99  }
100 
101  return in;
102 }
103 
104 // Below is the code related to the final exponentiation
105 // References:
106 // - https://eprint.iacr.org/2012/232.pdf
107 // - https://eprint.iacr.org/2016/130.pdf
108 
110  const bls12_377_Fq12 &elt)
111 {
112  // The content of this file follows: https://eprint.iacr.org/2016/130.pdf
113  //
114  // Note: in the alt_bn_128 implementation the libff authors used a trick by
115  // Beuchat et al. to compute the first chunk of the exponentiation which
116  // seems faster. Look into that and use it if it applies here too.
117  //
118  // TODO: Look into this.
119  enter_block("Call to bls12_377_final_exponentiation_first_chunk");
120 
121  // elt^(q^6)
122  const bls12_377_Fq12 A = elt.Frobenius_map(6);
123  // elt^(-1)
124  const bls12_377_Fq12 B = elt.inverse();
125  // elt^(q^6 - 1)
126  const bls12_377_Fq12 C = A * B;
127  // (elt^(q^6 - 1))^(q^2) = elt^((q^6 - 1) * (q^2))
128  const bls12_377_Fq12 D = C.Frobenius_map(2);
129  // elt^((q^6 - 1) * (q^2) + (q^6 - 1)) = elt^((q^6 - 1) * (q^2 + 1))
130  const bls12_377_Fq12 result = D * C;
131 
132  leave_block("Call to bls12_377_final_exponentiation_first_chunk");
133 
134  return result;
135 }
136 
138 {
139  enter_block("Call to bls12_377_exp_by_z");
140 
143  result = result.unitary_inverse();
144  }
145 
146  leave_block("Call to bls12_377_exp_by_z");
147 
148  return result;
149 }
150 
152  const bls12_377_Fq12 &elt)
153 {
154  enter_block("Call to bls12_377_final_exponentiation_last_chunk");
155 
156  // In the following, we follow the Algorithm 1 described in Table 1 of:
157  // https://eprint.iacr.org/2016/130.pdf in order to compute the
158  // hard part of the final exponentiation
159  //
160  // Note: As shown Table 3: https://eprint.iacr.org/2016/130.pdf this
161  // algorithm isn't optimal since Algorithm 2 allows to have less temp.
162  // variables and has a better complexity.
163  //
164  // In the following we denote by [x] = elt^(x):
165  // A = [-2]
167  // B = [z]
168  const bls12_377_Fq12 B = bls12_377_exp_by_z(elt);
169  // C = [2z]
170  const bls12_377_Fq12 C = B.cyclotomic_squared();
171  // D = [z-2]
172  const bls12_377_Fq12 D = A * B;
173  // E = [z^2-2z]
174  const bls12_377_Fq12 E = bls12_377_exp_by_z(D);
175  // F = [z^3-2z^2]
176  const bls12_377_Fq12 F = bls12_377_exp_by_z(E);
177  // G = [z^4-2z^3]
178  const bls12_377_Fq12 G = bls12_377_exp_by_z(F);
179  // H = [z^4-2z^3+2z]
180  const bls12_377_Fq12 H = G * C;
181  // I = [z^5-2z^4+2z^2]
182  const bls12_377_Fq12 I = bls12_377_exp_by_z(H);
183  // J = [-z+2]
184  const bls12_377_Fq12 J = D.unitary_inverse();
185  // K = [z^5-2z^4+2z^2-z+2]
186  const bls12_377_Fq12 K = I * J;
187  // L = [z^5-2z^4+2z^2-z+3] = [\lambda_0]
188  const bls12_377_Fq12 L = K * elt;
189  // M = [-1]
190  const bls12_377_Fq12 M = elt.unitary_inverse();
191  // N = [z^2-2z+1] = [\lambda_3]
192  const bls12_377_Fq12 N = E * elt;
193  // O = [(z^2-2z+1) * (q^3)]
194  const bls12_377_Fq12 O = N.Frobenius_map(3);
195  // P = [z^4-2z^3+2z-1] = [\lambda_1]
196  const bls12_377_Fq12 P = H * M;
197  // Q = [(z^4-2z^3+2z-1) * q]
198  const bls12_377_Fq12 Q = P.Frobenius_map(1);
199  // R = [z^3-2z^2+z] = [\lambda_2]
200  const bls12_377_Fq12 R = F * B;
201  // S = [(z^3-2z^2+z) * (q^2)]
202  const bls12_377_Fq12 S = R.Frobenius_map(2);
203  // T = [(z^2-2z+1) * (q^3) + (z^3-2z^2+z) * (q^2)]
204  const bls12_377_Fq12 T = O * S;
205  // U = [(z^2-2z+1) * (q^3) + (z^3-2z^2+z) * (q^2) + (z^4-2z^3+2z-1) * q]
206  const bls12_377_Fq12 U = T * Q;
207  // result = [(z^2-2z+1) * (q^3) + (z^3-2z^2+z) * (q^2) + (z^4-2z^3+2z-1) * q
208  // + z^5-2z^4+2z^2-z+3]
209  // = [(p^4 - p^2 + 1)/r].
210  const bls12_377_Fq12 result = U * L;
211 
212  leave_block("Call to bls12_377_final_exponentiation_last_chunk");
213 
214  return result;
215 }
216 
218 {
219  // We know that:
220  // (p^12 - 1) / r = (p^6 - 1) (p^2 + 1) ((p^4 - p^2 + 1) / r)
221  // |_________________| |__________________|
222  // easy part hard part
223  // where:
224  // sage: cyclotomic_polynomial(12) # = x^4 - x^2 + 1
225  enter_block("Call to bls12_377_final_exponentiation");
226 
227  // Compute the easy part
229  // Finish the final exponentiation by computing the hard part
231 
232  leave_block("Call to bls12_377_final_exponentiation");
233 
234  return result;
235 }
236 
237 // Below is the code related to the computation of the Ate pairing
238 
240  const bls12_377_Fq two_inv,
241  bls12_377_G2 &current,
243 {
244  // Below we assume that `current` = (X, Y, Z) \in E'(Fp2) is a point
245  // in homogeneous projective coordinates.
246  const bls12_377_Fq2 X = current.X, Y = current.Y, Z = current.Z;
247 
248  // Compute the line function
249 
250  // A = (X * Y)/ 2
251  const bls12_377_Fq2 A = two_inv * (X * Y);
252  // B = Y^2
253  const bls12_377_Fq2 B = Y.squared();
254  // C = Z^2
255  const bls12_377_Fq2 C = Z.squared();
256  // D = 3 * C
257  const bls12_377_Fq2 D = C + C + C;
258  // E = bls12_377_twist_coeff_b * D
260  // F = 3 * E
261  const bls12_377_Fq2 F = E + E + E;
262  // G = (B + F)/2
263  const bls12_377_Fq2 G = two_inv * (B + F);
264  // H = (Y + Z)^2 - (B + C) = 2YZ
265  const bls12_377_Fq2 H = (Y + Z).squared() - (B + C);
266  // I = E - B
267  const bls12_377_Fq2 I = E - B;
268  // J = X^2
269  const bls12_377_Fq2 J = X.squared();
270  // E_squared = E^2
271  const bls12_377_Fq2 E_squared = E.squared();
272 
273  // X = A * (B-F)
274  // = ((X * Y)/ 2) * (Y^2 - 3 * (bls12_377_twist_coeff_b * 3 * Z^2)
275  // = ((X * Y)/ 2) * (Y^2 - 9 * (bls12_377_twist_coeff_b * Z^2)
276  current.X = A * (B - F);
277  // Y = G^2 - 3*E^2
278  // = (Y^2 + 9 * bls12_377_twist_coeff_b * Z^2)/2 -
279  // 27*(bls12_377_twist_coeff_b^2 * Z^4)
280  current.Y = G.squared() - (E_squared + E_squared + E_squared);
281  // Z = B * H
282  // = Y^2 * 2YZ
283  // = 2Y^3 * Z
284  current.Z = B * H;
285 
286  // Note: We use a D-type twist
287  //
288  // See: Equation (2) https://eprint.iacr.org/2010/526.pdf
289  //
290  // The tangent line evaluated at the twisting point P = (x_p, y_p) is
291  // computed as:
292  // (-2YZ*y_p)vw + <-- -H
293  // (3*X^2 * x_p) * v^2 + <-- 3*J
294  // bls12_377_twist * bls12_377_twist * <-- bls12_377_twist * I
295  // (3*bls12_377_twist_coeff_b*Z^2 - Y^2)
296  c.ell_VW = -H;
297  c.ell_VV = J + J + J;
298  c.ell_0 = bls12_377_twist * I;
299 }
300 
302  const bls12_377_G2 &base,
303  bls12_377_G2 &current,
305 {
306  const bls12_377_Fq2 &X1 = current.X, &Y1 = current.Y, &Z1 = current.Z;
307  const bls12_377_Fq2 &X2 = base.X, &Y2 = base.Y;
308 
309  const bls12_377_Fq2 A = Y2 * Z1;
310  const bls12_377_Fq2 B = X2 * Z1;
311  const bls12_377_Fq2 theta = Y1 - A;
312  const bls12_377_Fq2 lambda = X1 - B;
313  const bls12_377_Fq2 C = theta.squared();
314  const bls12_377_Fq2 D = lambda.squared();
315  const bls12_377_Fq2 E = lambda * D;
316  const bls12_377_Fq2 F = Z1 * C;
317  const bls12_377_Fq2 G = X1 * D;
318  const bls12_377_Fq2 H = E + F - (G + G);
319  const bls12_377_Fq2 I = Y1 * E;
320  const bls12_377_Fq2 J = theta * X2 - lambda * Y2;
321 
322  current.X = lambda * H;
323  current.Y = theta * (G - H) - I;
324  current.Z = Z1 * E;
325 
326  c.ell_0 = bls12_377_twist * J;
327  // VV gets multiplied to xP during line evaluation at P
328  c.ell_VV = -theta;
329  // VW gets multiplied to yP during line evaluation at P
330  c.ell_VW = lambda;
331 }
332 
334 {
335  enter_block("Call to bls12_377_ate_precompute_G1");
336 
337  bls12_377_G1 Pcopy = P;
338  Pcopy.to_affine_coordinates();
339 
341  result.PX = Pcopy.X;
342  result.PY = Pcopy.Y;
343 
344  leave_block("Call to bls12_377_ate_precompute_G1");
345  return result;
346 }
347 
348 // Note the code below can be refactored to follow the approach
349 // detailled in Section 5: https://eprint.iacr.org/2019/077.pdf
350 // and simplify the Miller loop by calculating and storing the line
351 // functions in an array.
352 //
353 // Below, the computation of the pairing is done as follows:
354 // 1. Precompute the set of points R:
355 // s.t. init: R <- Q, double: R <- 2R, add: R <- R + Q
356 // 2. Use the set of precomputed Rs in the Miller Loop
357 // 3. Carry out the final exponentiation on the result of the Miller loop
358 // The last step is carried out in 2 sub-steps (note: is_even(k) = True since k
359 // = 12):
360 // - Carry out the easy part of the exponentiation
361 // - Carry out the hard part of the exponentiation
362 //
364 {
365  enter_block("Call to bls12_377_ate_precompute_G2");
366 
367  bls12_377_G2 Qcopy(Q);
368  Qcopy.to_affine_coordinates();
369 
370  // could add to global params if needed
371  bls12_377_Fq two_inv = (bls12_377_Fq("2").inverse());
372 
374  result.QX = Qcopy.X;
375  result.QY = Qcopy.Y;
376 
377  bls12_377_G2 R;
378  R.X = Qcopy.X;
379  R.Y = Qcopy.Y;
380  R.Z = bls12_377_Fq2::one();
381 
382  const bigint<bls12_377_Fq::num_limbs> &loop_count =
384  bool found_one = false;
386 
387  for (long i = loop_count.max_bits(); i >= 0; --i) {
388  const bool bit = loop_count.test_bit(i);
389  if (!found_one) {
390  // This skips the MSB itself
391  found_one |= bit;
392  continue;
393  }
394 
396  result.coeffs.push_back(c);
397 
398  if (bit) {
400  result.coeffs.push_back(c);
401  }
402  }
403 
404  leave_block("Call to bls12_377_ate_precompute_G2");
405  return result;
406 }
407 
409  const bls12_377_ate_G1_precomp &prec_P,
410  const bls12_377_ate_G2_precomp &prec_Q)
411 {
412  enter_block("Call to bls12_377_ate_miller_loop");
413 
415 
416  bool found_one = false;
417  size_t idx = 0;
418 
419  const bigint<bls12_377_Fq::num_limbs> &loop_count =
422 
423  // Added for DEBUG purpose
424  // TODO: Remove the 2 variables below
425  int nb_double = 0;
426  int nb_add = 0;
427 
428  // The loop length of the Miller algorithm is floor(log_2(u)), where
429  // u is the "curve parameter" used to sample the curve from the
430  // BLS12 family
431  for (long i = loop_count.max_bits(); i >= 0; --i) {
432  const bool bit = loop_count.test_bit(i);
433  if (!found_one) {
434  // This skips the MSB itself
435  found_one |= bit;
436  continue;
437  }
438 
439  // The code below gets executed for all bits (EXCEPT the MSB itself)
440  // of the binary representation of bls12_377_ate_loop_count
441  // (skipping leading zeros) in MSB to LSB order
442  c = prec_Q.coeffs[idx++];
443  f = f.squared();
444  // Sparse multiplication in Fq12
445  f = f.mul_by_024(c.ell_0, prec_P.PY * c.ell_VW, prec_P.PX * c.ell_VV);
446  nb_double++;
447 
448  if (bit) {
449  c = prec_Q.coeffs[idx++];
450  f = f.mul_by_024(
451  c.ell_0, prec_P.PY * c.ell_VW, prec_P.PX * c.ell_VV);
452  nb_add++;
453  }
454  }
455 
456  // Note: bls12_377_ate_is_loop_count_neg = false BUT this is not the case
457  // for BLS12-381!
458 
459  std::cout << "[DEBUG] NB_DOUBLE (Should be 63): " << nb_double
460  << " NB_ADD (Should be 7): " << nb_add << std::endl;
461  leave_block("Call to bls12_377_ate_miller_loop");
462  return f;
463 }
464 
466  const bls12_377_ate_G1_precomp &prec_P1,
467  const bls12_377_ate_G2_precomp &prec_Q1,
468  const bls12_377_ate_G1_precomp &prec_P2,
469  const bls12_377_ate_G2_precomp &prec_Q2)
470 {
471  enter_block("Call to bls12_377_ate_double_miller_loop");
472 
474 
475  bool found_one = false;
476  size_t idx = 0;
477 
478  const bigint<bls12_377_Fq::num_limbs> &loop_count =
480  for (long i = loop_count.max_bits(); i >= 0; --i) {
481  const bool bit = loop_count.test_bit(i);
482  if (!found_one) {
483  // This skips the MSB itself
484  found_one |= bit;
485  continue;
486  }
487 
488  // The code below gets executed for all bits (EXCEPT the MSB itself)
489  // of the binary representation of bls12_377_ate_loop_count
490  // (skipping leading zeros) in MSB to LSB order
491  bls12_377_ate_ell_coeffs c1 = prec_Q1.coeffs[idx];
492  bls12_377_ate_ell_coeffs c2 = prec_Q2.coeffs[idx];
493  ++idx;
494 
495  f = f.squared();
496 
497  f = f.mul_by_024(
498  c1.ell_0, prec_P1.PY * c1.ell_VW, prec_P1.PX * c1.ell_VV);
499  f = f.mul_by_024(
500  c2.ell_0, prec_P2.PY * c2.ell_VW, prec_P2.PX * c2.ell_VV);
501 
502  if (bit) {
503  bls12_377_ate_ell_coeffs c1 = prec_Q1.coeffs[idx];
504  bls12_377_ate_ell_coeffs c2 = prec_Q2.coeffs[idx];
505  ++idx;
506 
507  f = f.mul_by_024(
508  c1.ell_0, prec_P1.PY * c1.ell_VW, prec_P1.PX * c1.ell_VV);
509  f = f.mul_by_024(
510  c2.ell_0, prec_P2.PY * c2.ell_VW, prec_P2.PX * c2.ell_VV);
511  }
512  }
513 
514  leave_block("Call to bls12_377_ate_double_miller_loop");
515 
516  return f;
517 }
518 
520  const bls12_377_G1 &P, const bls12_377_G2 &Q)
521 {
522  enter_block("Call to bls12_377_ate_pairing");
525  bls12_377_Fq12 result = bls12_377_ate_miller_loop(prec_P, prec_Q);
526  leave_block("Call to bls12_377_ate_pairing");
527  return result;
528 }
529 
531  const bls12_377_G1 &P, const bls12_377_G2 &Q)
532 {
533  enter_block("Call to bls12_377_ate_reduced_pairing");
534  const bls12_377_Fq12 f = bls12_377_ate_pairing(P, Q);
536  leave_block("Call to bls12_377_ate_reduced_pairing");
537  return result;
538 }
539 
540 /* choice of pairing */
541 
543 {
544  return bls12_377_ate_precompute_G1(P);
545 }
546 
548 {
549  return bls12_377_ate_precompute_G2(Q);
550 }
551 
553  const bls12_377_G1_precomp &prec_P, const bls12_377_G2_precomp &prec_Q)
554 {
555  return bls12_377_ate_miller_loop(prec_P, prec_Q);
556 }
557 
559  const bls12_377_G1_precomp &prec_P1,
560  const bls12_377_G2_precomp &prec_Q1,
561  const bls12_377_G1_precomp &prec_P2,
562  const bls12_377_G2_precomp &prec_Q2)
563 {
564  return bls12_377_ate_double_miller_loop(prec_P1, prec_Q1, prec_P2, prec_Q2);
565 }
566 
568 {
569  return bls12_377_ate_pairing(P, Q);
570 }
571 
573  const bls12_377_G1 &P, const bls12_377_G2 &Q)
574 {
575  return bls12_377_ate_reduced_pairing(P, Q);
576 }
577 } // namespace libff
libff::Fp2_model::coeffs
my_Fp coeffs[2]
Definition: fp2.hpp:63
libff::bls12_377_miller_loop
bls12_377_Fq12 bls12_377_miller_loop(const bls12_377_G1_precomp &prec_P, const bls12_377_G2_precomp &prec_Q)
Definition: bls12_377_pairing.cpp:552
libff::bls12_377_ate_G2_precomp::QY
bls12_377_Fq2 QY
Definition: bls12_377_pairing.hpp:47
libff::bls12_377_ate_G1_precomp::PY
bls12_377_Fq PY
Definition: bls12_377_pairing.hpp:24
bls12_377_init.hpp
libff::bls12_377_doubling_step_for_miller_loop
void bls12_377_doubling_step_for_miller_loop(const bls12_377_Fq two_inv, bls12_377_G2 &current, bls12_377_ate_ell_coeffs &c)
Definition: bls12_377_pairing.cpp:239
libff::bls12_377_ate_miller_loop
bls12_377_Fq12 bls12_377_ate_miller_loop(const bls12_377_ate_G1_precomp &prec_P, const bls12_377_ate_G2_precomp &prec_Q)
Definition: bls12_377_pairing.cpp:408
libff::bls12_377_final_exponentiation_last_chunk
bls12_377_Fq12 bls12_377_final_exponentiation_last_chunk(const bls12_377_Fq12 &elt)
Definition: bls12_377_pairing.cpp:151
libff::bls12_377_pairing
bls12_377_Fq12 bls12_377_pairing(const bls12_377_G1 &P, const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:567
libff::enter_block
void enter_block(const std::string &msg, const bool indent)
Definition: profiling.cpp:271
libff::bls12_377_ate_G2_precomp::operator==
bool operator==(const bls12_377_ate_G2_precomp &other) const
Definition: bls12_377_pairing.cpp:60
libff::bls12_377_G2
Definition: bls12_377_g2.hpp:21
libff::bls12_377_precompute_G2
bls12_377_G2_precomp bls12_377_precompute_G2(const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:547
libff::bls12_377_reduced_pairing
bls12_377_GT bls12_377_reduced_pairing(const bls12_377_G1 &P, const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:572
libff::bls12_377_final_exponent_is_z_neg
bool bls12_377_final_exponent_is_z_neg
Definition: bls12_377_init.cpp:48
libff
Definition: ffi.cpp:8
libff::Fp2_model< bls12_377_q_limbs, bls12_377_modulus_q >::one
static const Fp2_model< n, modulus > & one()
libff::bls12_377_ate_loop_count
bigint< bls12_377_q_limbs > bls12_377_ate_loop_count
Definition: bls12_377_init.cpp:43
libff::bls12_377_final_exponent_z
bigint< bls12_377_q_limbs > bls12_377_final_exponent_z
Definition: bls12_377_init.cpp:47
libff::bls12_377_ate_ell_coeffs::ell_0
bls12_377_Fq2 ell_0
Definition: bls12_377_pairing.hpp:34
libff::bls12_377_ate_G2_precomp
Definition: bls12_377_pairing.hpp:45
libff::Fp12_2over3over2_model::one
static Fp12_2over3over2_model< n, modulus > one()
libff::operator>>
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
Definition: alt_bn128_g1.cpp:446
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_twist_coeff_b
bls12_377_Fq2 bls12_377_twist_coeff_b
Definition: bls12_377_init.cpp:19
libff::Fp12_2over3over2_model::squared
Fp12_2over3over2_model squared() const
default is squared_complex
bls12_377_g2.hpp
libff::bls12_377_ate_pairing
bls12_377_Fq12 bls12_377_ate_pairing(const bls12_377_G1 &P, const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:519
libff::bls12_377_G1
Definition: bls12_377_g1.hpp:21
libff::bls12_377_ate_G1_precomp::operator==
bool operator==(const bls12_377_ate_G1_precomp &other) const
Definition: bls12_377_pairing.cpp:11
libff::bls12_377_G2::to_affine_coordinates
void to_affine_coordinates()
Definition: bls12_377_g2.cpp:82
libff::bls12_377_ate_ell_coeffs::ell_VW
bls12_377_Fq2 ell_VW
Definition: bls12_377_pairing.hpp:35
libff::bls12_377_precompute_G1
bls12_377_G1_precomp bls12_377_precompute_G1(const bls12_377_G1 &P)
Definition: bls12_377_pairing.cpp:542
OUTPUT_SEPARATOR
#define OUTPUT_SEPARATOR
Definition: serialization.hpp:69
libff::Fp12_2over3over2_model::Frobenius_map
Fp12_2over3over2_model Frobenius_map(unsigned long power) const
libff::bls12_377_ate_ell_coeffs
Definition: bls12_377_pairing.hpp:33
libff::bigint::max_bits
static constexpr size_t max_bits()
The number of bits representable by this bigint type.
Definition: bigint.hpp:51
libff::bls12_377_ate_G1_precomp::PX
bls12_377_Fq PX
Definition: bls12_377_pairing.hpp:23
libff::bls12_377_G1::to_affine_coordinates
void to_affine_coordinates()
Definition: bls12_377_g1.cpp:65
libff::Fp12_2over3over2_model::inverse
Fp12_2over3over2_model inverse() const
libff::bls12_377_G2::X
bls12_377_Fq2 X
Definition: bls12_377_g2.hpp:45
libff::Fp12_2over3over2_model::mul_by_024
Fp12_2over3over2_model mul_by_024(const my_Fp2 &ell_0, const my_Fp2 &ell_VW, const my_Fp2 &ell_VV) const
libff::consume_OUTPUT_SEPARATOR
void consume_OUTPUT_SEPARATOR(std::istream &in)
libff::bls12_377_ate_G1_precomp
Definition: bls12_377_pairing.hpp:22
libff::bls12_377_G2::Z
bls12_377_Fq2 Z
Definition: bls12_377_g2.hpp:45
bls12_377_g1.hpp
libff::bigint
Definition: bigint.hpp:20
libff::Fp12_2over3over2_model::unitary_inverse
Fp12_2over3over2_model unitary_inverse() const
libff::bls12_377_ate_reduced_pairing
bls12_377_GT bls12_377_ate_reduced_pairing(const bls12_377_G1 &P, const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:530
libff::Fp12_2over3over2_model
Definition: fp12_2over3over2.hpp:20
libff::Fp12_2over3over2_model::cyclotomic_exp
Fp12_2over3over2_model cyclotomic_exp(const bigint< m > &exponent) const
libff::bls12_377_mixed_addition_step_for_miller_loop
void bls12_377_mixed_addition_step_for_miller_loop(const bls12_377_G2 &base, bls12_377_G2 &current, bls12_377_ate_ell_coeffs &c)
Definition: bls12_377_pairing.cpp:301
libff::bls12_377_ate_ell_coeffs::ell_VV
bls12_377_Fq2 ell_VV
Definition: bls12_377_pairing.hpp:36
bls12_377_pairing.hpp
libff::bls12_377_final_exponentiation_first_chunk
bls12_377_Fq12 bls12_377_final_exponentiation_first_chunk(const bls12_377_Fq12 &elt)
Definition: bls12_377_pairing.cpp:109
libff::bls12_377_twist
bls12_377_Fq2 bls12_377_twist
Definition: bls12_377_init.cpp:18
libff::Fp_model< bls12_377_q_limbs, bls12_377_modulus_q >
libff::bls12_377_G1::X
bls12_377_Fq X
Definition: bls12_377_g1.hpp:44
libff::operator<<
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
Definition: alt_bn128_g1.cpp:436
libff::bls12_377_ate_ell_coeffs::operator==
bool operator==(const bls12_377_ate_ell_coeffs &other) const
Definition: bls12_377_pairing.cpp:34
libff::consume_OUTPUT_NEWLINE
void consume_OUTPUT_NEWLINE(std::istream &in)
libff::bls12_377_final_exponentiation
bls12_377_GT bls12_377_final_exponentiation(const bls12_377_Fq12 &elt)
Definition: bls12_377_pairing.cpp:217
libff::bls12_377_ate_G2_precomp::QX
bls12_377_Fq2 QX
Definition: bls12_377_pairing.hpp:46
libff::Fp2_model::squared
Fp2_model squared() const
default is squared_complex
libff::Fp2_model
Definition: fp2.hpp:18
profiling.hpp
libff::bls12_377_G1::Y
bls12_377_Fq Y
Definition: bls12_377_g1.hpp:44
libff::leave_block
void leave_block(const std::string &msg, const bool indent)
Definition: profiling.cpp:305
libff::Fp12_2over3over2_model::cyclotomic_squared
Fp12_2over3over2_model cyclotomic_squared() const
OUTPUT_NEWLINE
#define OUTPUT_NEWLINE
Definition: serialization.hpp:68
libff::bls12_377_G2::Y
bls12_377_Fq2 Y
Definition: bls12_377_g2.hpp:45
libff::bigint::test_bit
bool test_bit(const std::size_t bitno) const
libff::bls12_377_ate_precompute_G2
bls12_377_ate_G2_precomp bls12_377_ate_precompute_G2(const bls12_377_G2 &Q)
Definition: bls12_377_pairing.cpp:363
libff::bls12_377_ate_G2_precomp::coeffs
std::vector< bls12_377_ate_ell_coeffs > coeffs
Definition: bls12_377_pairing.hpp:48
libff::bls12_377_ate_precompute_G1
bls12_377_ate_G1_precomp bls12_377_ate_precompute_G1(const bls12_377_G1 &P)
Definition: bls12_377_pairing.cpp:333
libff::bls12_377_ate_double_miller_loop
bls12_377_Fq12 bls12_377_ate_double_miller_loop(const bls12_377_ate_G1_precomp &prec_P1, const bls12_377_ate_G2_precomp &prec_Q1, const bls12_377_ate_G1_precomp &prec_P2, const bls12_377_ate_G2_precomp &prec_Q2)
Definition: bls12_377_pairing.cpp:465
libff::consume_newline
void consume_newline(std::istream &in)
libff::bls12_377_double_miller_loop
bls12_377_Fq12 bls12_377_double_miller_loop(const bls12_377_G1_precomp &prec_P1, const bls12_377_G2_precomp &prec_Q1, const bls12_377_G1_precomp &prec_P2, const bls12_377_G2_precomp &prec_Q2)
Definition: bls12_377_pairing.cpp:558
libff::bls12_377_exp_by_z
bls12_377_Fq12 bls12_377_exp_by_z(const bls12_377_Fq12 &elt)
Definition: bls12_377_pairing.cpp:137