Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
Go to the documentation of this file.
23 this->c_XZ == other.
c_XZ);
47 out << prec_P.size() <<
"\n";
65 for (
size_t i = 0; i < s; ++i) {
69 prec_P.emplace_back(cc);
78 return (this->
y0 == other.
y0 && this->eta == other.
eta);
101 this->c_XZ == other.
c_XZ);
125 out << prec_Q.size() <<
"\n";
144 for (
size_t i = 0; i < s; ++i) {
148 prec_Q.emplace_back(cc);
182 enter_block(
"Call to edwards_final_exponentiation_last_chunk");
195 leave_block(
"Call to edwards_final_exponentiation_last_chunk");
203 enter_block(
"Call to edwards_final_exponentiation_first_chunk");
210 const edwards_Fq6 elt_q3_over_elt = elt_q3 * elt_inv;
215 leave_block(
"Call to edwards_final_exponentiation_first_chunk");
221 enter_block(
"Call to edwards_final_exponentiation");
228 elt_to_first_chunk, elt_inv_to_first_chunk);
229 leave_block(
"Call to edwards_final_exponentiation");
242 (Qcopy.
Z + Qcopy.
Y) *
257 printf(
"extended edwards_G1 projective X/Y/Z/T:\n");
270 const edwards_Fq &X = current.
X, &Y = current.
Y, &Z = current.
Z,
284 cc.
c_ZZ = Y * (T - X);
292 current.
Y = I * (B - H);
294 current.
T = F * (B - H);
306 const edwards_Fq &X1 = current.
X, &Y1 = current.
Y, &Z1 = current.
Z,
308 const edwards_Fq &X2 = base.
X, &Y2 = base.
Y, &Z2 = base.
Z, &T2 = base.
T;
316 (X1 - Y1) * (X2 + Y2) + B - A;
321 cc.
c_ZZ = (T1 - X1) * (T2 + X2) - I + A;
322 cc.
c_XY = X1 * Z2 - X2 * Z1 + F;
323 cc.
c_XZ = (Y1 - T1) * (Y2 + T2) - B + I - H;
339 const edwards_Fq &X1 = current.
X, &Y1 = current.
Y, &Z1 = current.
Z,
349 (X1 - Y1) * (X2 + Y2) + B - A;
354 cc.
c_ZZ = (T1 - X1) * (T2 + X2) - I + A;
355 cc.
c_XY = X1 - X2 * Z1 + F;
356 cc.
c_XZ = (Y1 - T1) * (Y2 + T2) - B + I - H;
379 P_ext.
T = Pcopy.
X * Pcopy.
Y;
383 bool found_one =
false;
397 result.push_back(cc);
401 result.push_back(cc);
417 bool found_one =
false;
464 enter_block(
"Call to edwards_tate_reduced_pairing");
467 leave_block(
"Call to edwards_tate_reduce_pairing");
479 printf(
"extended edwards_G2 projective X/Y/Z/T:\n");
508 cc.
c_ZZ = Y * (T - X);
522 current.
Y = I * (B - H);
524 current.
T = F * (B - H);
535 const edwards_Fq3 &X1 = current.
X, &Y1 = current.
Y, &Z1 = current.
Z,
537 const edwards_Fq3 &X2 = base.
X, &Y2 = base.
Y, &Z2 = base.
Z, &T2 = base.
T;
545 (X1 - Y1) * (X2 + Y2) + B - A;
555 (T1 - X1) * (T2 + X2) - I +
558 cc.
c_XY = X1 * Z2 - X2 * Z1 + F;
559 cc.
c_XZ = (Y1 - T1) * (Y2 + T2) - B + I - H;
575 const edwards_Fq3 &X1 = current.
X, &Y1 = current.
Y, &Z1 = current.
Z,
584 (X1 - Y1) * (X2 + Y2) + B - A;
594 (T1 - X1) * (T2 + X2) - I +
597 cc.
c_XY = X1 - X2 * Z1 + F;
598 cc.
c_XZ = (Y1 - T1) * (Y2 + T2) - B + I - H;
615 result.
P_XY = Pcopy.
X * Pcopy.
Y;
616 result.
P_XZ = Pcopy.
X;
636 Q_ext.
T = Qcopy.
X * Qcopy.
Y;
640 bool found_one =
false;
641 for (
long i = loop_count.
max_bits() - 1; i >= 0; --i) {
642 const bool bit = loop_count.
test_bit(i);
651 result.push_back(cc);
654 result.push_back(cc);
670 bool found_one =
false;
672 for (
long i = loop_count.
max_bits() - 1; i >= 0; --i) {
673 const bool bit = loop_count.
test_bit(i);
708 enter_block(
"Call to edwards_ate_double_miller_loop");
713 bool found_one =
false;
715 for (
long i = loop_count.
max_bits() - 1; i >= 0; --i) {
716 const bool bit = loop_count.
test_bit(i);
737 f = f.
squared() * g_RR_at_P1 * g_RR_at_P2;
749 f = f * g_RQ_at_P1 * g_RQ_at_P2;
752 leave_block(
"Call to edwards_ate_double_miller_loop");
769 enter_block(
"Call to edwards_ate_reduced_pairing");
772 leave_block(
"Call to edwards_ate_reduced_pairing");
static Fp6_2over3_model< n, modulus > one()
edwards_Fq6 edwards_final_exponentiation_last_chunk(const edwards_Fq6 &elt, const edwards_Fq6 &elt_inv)
bigint< edwards_q_limbs > edwards_final_exponent_last_chunk_w1
void enter_block(const std::string &msg, const bool indent)
void test_invariant() const
std::vector< edwards_Fq3_conic_coefficients > edwards_ate_G2_precomp
void doubling_step_for_flipped_miller_loop(const alt_bn128_Fq two_inv, alt_bn128_G2 ¤t, alt_bn128_ate_ell_coeffs &c)
edwards_Fq6 edwards_pairing(const edwards_G1 &P, const edwards_G2 &Q)
static my_Fp3 mul_by_non_residue(const my_Fp3 &elem)
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static edwards_Fq3 mul_by_a(const edwards_Fq3 &elt)
edwards_G2_precomp edwards_precompute_G2(const edwards_G2 &Q)
void test_invariant() const
void mixed_addition_step_for_flipped_miller_loop(const alt_bn128_G2 base, alt_bn128_G2 ¤t, alt_bn128_ate_ell_coeffs &c)
edwards_ate_G2_precomp edwards_G2_precomp
edwards_tate_G2_precomp edwards_tate_precompute_G2(const edwards_G2 &Q)
edwards_ate_G2_precomp edwards_ate_precompute_G2(const edwards_G2 &Q)
edwards_Fq6 edwards_miller_loop(const edwards_G1_precomp &prec_P, const edwards_G2_precomp &prec_Q)
bool edwards_final_exponent_last_chunk_is_w0_neg
bigint< edwards_q_limbs > edwards_final_exponent_last_chunk_abs_of_w0
bool operator==(const edwards_ate_G1_precomp &other) const
bool operator==(const edwards_Fq_conic_coefficients &other) const
edwards_Fq6 edwards_tate_pairing(const edwards_G1 &P, const edwards_G2 &Q)
bigint< edwards_q_limbs > edwards_ate_loop_count
void to_affine_coordinates()
static const Fp_model< n, modulus > & one()
static constexpr size_t max_bits()
The number of bits representable by this bigint type.
edwards_GT edwards_tate_reduced_pairing(const edwards_G1 &P, const edwards_G2 &Q)
edwards_tate_G1_precomp edwards_tate_precompute_G1(const edwards_G1 &P)
void consume_OUTPUT_SEPARATOR(std::istream &in)
bigint< edwards_r_limbs > edwards_modulus_r
void full_addition_step_for_flipped_miller_loop(const extended_edwards_G2_projective &base, extended_edwards_G2_projective ¤t, edwards_Fq3_conic_coefficients &cc)
edwards_Fq6 edwards_ate_double_miller_loop(const edwards_ate_G1_precomp &prec_P1, const edwards_ate_G2_precomp &prec_Q1, const edwards_ate_G1_precomp &prec_P2, const edwards_ate_G2_precomp &prec_Q2)
Fp6_2over3_model Frobenius_map(unsigned long power) const
edwards_G1_precomp edwards_precompute_G1(const edwards_G1 &P)
edwards_Fq6 edwards_ate_miller_loop(const edwards_ate_G1_precomp &prec_P, const edwards_ate_G2_precomp &prec_Q)
edwards_ate_G1_precomp edwards_ate_precompute_G1(const edwards_G1 &P)
void full_addition_step_for_miller_loop(const extended_edwards_G1_projective &base, extended_edwards_G1_projective ¤t, edwards_Fq_conic_coefficients &cc)
bool operator==(const edwards_tate_G2_precomp &other) const
Fp3_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq3
edwards_Fq6 edwards_tate_miller_loop(const edwards_tate_G1_precomp &prec_P, const edwards_tate_G2_precomp &prec_Q)
edwards_GT edwards_final_exponentiation(const edwards_Fq6 &elt)
void mixed_addition_step_for_miller_loop(const bw6_761_G2 base, bw6_761_G2 ¤t, bw6_761_ate_ell_coeffs &c)
edwards_Fq6 edwards_final_exponentiation_first_chunk(const edwards_Fq6 &elt, const edwards_Fq6 &elt_inv)
Fp_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
Fp3_model inverse() const
edwards_GT edwards_reduced_pairing(const edwards_G1 &P, const edwards_G2 &Q)
void consume_OUTPUT_NEWLINE(std::istream &in)
Fp6_2over3_model cyclotomic_exp(const bigint< m > &exponent) const
void leave_block(const std::string &msg, const bool indent)
bool operator==(const edwards_Fq3_conic_coefficients &other) const
Fp6_2over3_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq6
edwards_Fq6 edwards_ate_pairing(const edwards_G1 &P, const edwards_G2 &Q)
edwards_Fq6 edwards_double_miller_loop(const edwards_G1_precomp &prec_P1, const edwards_G2_precomp &prec_Q1, const edwards_G1_precomp &prec_P2, const edwards_G2_precomp &prec_Q2)
void doubling_step_for_miller_loop(bw6_761_G2 ¤t, bw6_761_ate_ell_coeffs &c)
bool test_bit(const std::size_t bitno) const
std::vector< edwards_Fq_conic_coefficients > edwards_tate_G1_precomp
void consume_newline(std::istream &in)
Fp3_model squared() const
Fp6_2over3_model inverse() const
void to_affine_coordinates()
edwards_GT edwards_ate_reduced_pairing(const edwards_G1 &P, const edwards_G2 &Q)
Fp6_2over3_model squared() const