Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
Go to the documentation of this file.
14 return (this->
PX == other.
PX && this->PY == other.
PY);
39 this->ell_VV == other.
ell_VV);
64 this->
QX == other.
QX && this->QY == other.
QY &&
65 this->coeffs == other.
coeffs);
72 out << prec_Q.
coeffs.size() <<
"\n";
95 for (
size_t i = 0; i < s; ++i) {
99 prec_Q.
coeffs.emplace_back(c);
134 enter_block(
"Call to bw6_761_final_exponentiation_first_chunk");
146 leave_block(
"Call to bw6_761_final_exponentiation_first_chunk");
174 enter_block(
"Call to bw6_761_final_exponentiation_last_chunk");
207 result2 * f5 * f0p * (f0 * f1 * f3 * f4_2p * f8p).Frobenius_map(3);
218 result6 * f4_2p_5p * f6 * f7p * (f2_4p * f3 * f3p).Frobenius_map(3);
223 result8 * f0 * f7 * f1p * (f0p * f9p).Frobenius_map(3);
230 result10 * f5_7p * f2p * (f6p_8p).Frobenius_map(3);
237 result12 * f3_6 * f9p * (f1_7 * f2).Frobenius_map(3);
241 const bw6_761_Fq6 result15 = result14 * f0 * f0p * f3p * f5p *
242 (f4_2p * f5_7p * f6p_8p).Frobenius_map(3);
246 const bw6_761_Fq6 result17 = result16 * f1p * (f3_6).Frobenius_map(3);
250 const bw6_761_Fq6 result19 = result18 * f1_7 * f5_7p * f0p *
251 (f2_4p * f4_2p_5p * f9p).Frobenius_map(3);
253 leave_block(
"Call to bw6_761_final_exponentiation_last_chunk");
260 enter_block(
"Call to bw6_761_final_exponentiation");
267 leave_block(
"Call to bw6_761_final_exponentiation");
277 const bw6_761_Fq X = current.
X, Y = current.
Y, Z = current.
Z;
296 const bw6_761_Fq H = (Y + Z).squared() - (B + C);
302 const bw6_761_Fq E2_squared = (E + E).squared();
305 current.
X = (A + A) * (B - F);
307 current.
Y = G.
squared() - (E2_squared + E2_squared + E2_squared);
322 const bw6_761_Fq X1 = current.
X, Y1 = current.
Y, Z1 = current.
Z;
343 current.
Y = E * (I - J) - (H * Y1);
347 c.
ell_0 = E * X2 - D * Y2;
369 static bw6_761_ate_G2_precomp_iteration bw6_761_ate_precompute_G2_internal(
370 const bw6_761_G2 &Q,
const bigint<bw6_761_Fq::num_limbs> &loop_count)
375 Qcopy.to_affine_coordinates();
377 bw6_761_ate_G2_precomp_iteration result;
386 bool found_nonzero =
false;
387 bw6_761_ate_ell_coeffs c;
389 std::vector<long> NAF =
find_wnaf(1, loop_count);
390 for (
long i = NAF.size() - 1; i >= 0; --i) {
391 if (!found_nonzero) {
393 found_nonzero |= (NAF[i] != 0);
398 result.coeffs.push_back(c);
406 result.coeffs.push_back(c);
434 bool found_nonzero_1 =
false;
444 std::vector<long> NAF_1 =
find_wnaf(1, loop_count_1);
445 for (
long i = NAF_1.size() - 1; i >= 0; --i) {
446 if (!found_nonzero_1) {
448 found_nonzero_1 |= (NAF_1[i] != 0);
455 c_1 = prec_Q_1.
coeffs[idx_1];
462 c_1 = prec_Q_1.
coeffs[idx_1];
472 bool found_nonzero_2 =
false;
478 std::vector<long> NAF_2 =
find_wnaf(1, loop_count_2);
479 for (
long i = NAF_2.size() - 1; i >= 0; --i) {
480 if (!found_nonzero_2) {
482 found_nonzero_2 |= (NAF_2[i] != 0);
489 c_2 = prec_Q_2.
coeffs[idx_2++];
495 c_2 = prec_Q_2.
coeffs[idx_2++];
514 enter_block(
"Call to bw6_761_ate_double_miller_loop");
524 bool found_nonzero_1 =
false;
532 std::vector<long> NAF_1 =
find_wnaf(1, loop_count_1);
533 for (
long i = NAF_1.size() - 1; i >= 0; --i) {
534 if (!found_nonzero_1) {
536 found_nonzero_1 |= (NAF_1[i] != 0);
543 c_1_1 = prec_Q1_1.
coeffs[idx_1];
544 c_1_2 = prec_Q1_2.
coeffs[idx_1];
554 c_1_1 = prec_Q1_1.
coeffs[idx_1];
555 c_1_2 = prec_Q1_2.
coeffs[idx_1];
572 bool found_nonzero_2 =
false;
580 std::vector<long> NAF_2 =
find_wnaf(1, loop_count_2);
581 for (
long i = NAF_2.size() - 1; i >= 0; --i) {
582 if (!found_nonzero_2) {
584 found_nonzero_2 |= (NAF_2[i] != 0);
591 c_2_1 = prec_Q2_1.
coeffs[idx_2];
592 c_2_2 = prec_Q2_2.
coeffs[idx_2];
603 c_2_1 = prec_Q2_1.
coeffs[idx_2];
604 c_2_2 = prec_Q2_2.
coeffs[idx_2];
618 leave_block(
"Call to bw6_761_ate_double_miller_loop");
637 enter_block(
"Call to bw6_761_ate_reduced_pairing");
640 leave_block(
"Call to bw6_761_ate_reduced_pairing");
static Fp6_2over3_model< n, modulus > one()
bw6_761_GT bw6_761_reduced_pairing(const bw6_761_G1 &P, const bw6_761_G2 &Q)
bool operator==(const bw6_761_ate_ell_coeffs &other) const
void enter_block(const std::string &msg, const bool indent)
bw6_761_Fq6 bw6_761_final_exponentiation_first_chunk(const bw6_761_Fq6 &elt)
bw6_761_Fq6 bw6_761_miller_loop(const bw6_761_G1_precomp &prec_P, const bw6_761_G2_precomp &prec_Q)
bool operator==(const bw6_761_ate_G1_precomp &other) const
Fp6_2over3_model mul_by_045(const my_Fp &ell_0, const my_Fp &ell_VW, const my_Fp &ell_VV) const
bw6_761_Fq6 bw6_761_ate_double_miller_loop(const bw6_761_ate_G1_precomp &prec_P1, const bw6_761_ate_G2_precomp &prec_Q1, const bw6_761_ate_G1_precomp &prec_P2, const bw6_761_ate_G2_precomp &prec_Q2)
bw6_761_Fq6 bw6_761_ate_miller_loop(const bw6_761_ate_G1_precomp &prec_P, const bw6_761_ate_G2_precomp &prec_Q)
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
bw6_761_Fq6 bw6_761_pairing(const bw6_761_G1 &P, const bw6_761_G2 &Q)
bool operator==(const bw6_761_ate_G2_precomp &other) const
bw6_761_ate_G2_precomp_iteration precomp_2
bigint< bw6_761_q_limbs > bw6_761_ate_loop_count2
Fp6_2over3_model unitary_inverse() const
static const Fp_model< n, modulus > & one()
bw6_761_GT bw6_761_final_exponentiation(const bw6_761_Fq6 &elt)
bool bw6_761_final_exponent_is_z_neg
bw6_761_ate_G1_precomp bw6_761_ate_precompute_G1(const bw6_761_G1 &P)
bw6_761_ate_G2_precomp bw6_761_ate_precompute_G2(const bw6_761_G2 &Q)
bw6_761_Fq6 bw6_761_exp_by_z(const bw6_761_Fq6 &elt)
void consume_OUTPUT_SEPARATOR(std::istream &in)
bw6_761_Fq6 bw6_761_final_exponentiation_last_chunk(const bw6_761_Fq6 &elt)
std::vector< bw6_761_ate_ell_coeffs > coeffs
bw6_761_ate_G2_precomp_iteration precomp_1
Fp6_2over3_model Frobenius_map(unsigned long power) const
bw6_761_GT bw6_761_ate_reduced_pairing(const bw6_761_G1 &P, const bw6_761_G2 &Q)
bw6_761_G1_precomp bw6_761_precompute_G1(const bw6_761_G1 &P)
void mixed_addition_step_for_miller_loop(const bw6_761_G2 base, bw6_761_G2 ¤t, bw6_761_ate_ell_coeffs &c)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
bigint< bw6_761_q_limbs > bw6_761_final_exponent_z
void consume_OUTPUT_NEWLINE(std::istream &in)
Fp6_2over3_model cyclotomic_exp(const bigint< m > &exponent) const
std::vector< long > find_wnaf(const size_t window_size, const bigint< n > &scalar)
bool operator==(const bw6_761_ate_G2_precomp_iteration &other) const
void leave_block(const std::string &msg, const bool indent)
bw6_761_Fq bw6_761_twist_coeff_b
void doubling_step_for_miller_loop(bw6_761_G2 ¤t, bw6_761_ate_ell_coeffs &c)
bw6_761_Fq6 bw6_761_double_miller_loop(const bw6_761_ate_G1_precomp &prec_P1, const bw6_761_ate_G2_precomp &prec_Q1, const bw6_761_ate_G1_precomp &prec_P2, const bw6_761_ate_G2_precomp &prec_Q2)
bw6_761_G2_precomp bw6_761_precompute_G2(const bw6_761_G2 &Q)
void consume_newline(std::istream &in)
Fp6_2over3_model inverse() const
Fp6_2over3_model squared() const
bw6_761_Fq6 bw6_761_ate_pairing(const bw6_761_G1 &P, const bw6_761_G2 &Q)
bigint< bw6_761_q_limbs > bw6_761_ate_loop_count1
void to_affine_coordinates()