Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
Go to the documentation of this file.
13 #ifdef PROFILE_OP_COUNTS
14 long long bls12_377_G2::add_cnt = 0;
15 long long bls12_377_G2::dbl_cnt = 0;
48 "(%Nd*z + %Nd , %Nd*z + %Nd)\n",
66 "(%Nd*z + %Nd : %Nd*z + %Nd : %Nd*z + %Nd)\n",
69 this->X.coeffs[0].as_bigint().data,
71 this->Y.coeffs[1].as_bigint().data,
73 this->Y.coeffs[0].as_bigint().data,
75 this->Z.coeffs[1].as_bigint().data,
77 this->Z.coeffs[0].as_bigint().data,
92 this->
X = this->
X * Z2_inv;
93 this->
Y = this->
Y * Z3_inv;
127 if (((this->
X * Z2_squared) != (other.
X * Z1_squared)) ||
128 ((this->
Y * Z2_cubed) != (other.
Y * Z1_cubed))) {
171 if (U1 == U2 && S1 == S2) {
206 return (*
this) + (-other);
224 if (this->
operator==(other)) {
228 #ifdef PROFILE_OP_COUNTS
296 if (this->
X == U2 && this->
Y == S2) {
300 #ifdef PROFILE_OP_COUNTS
324 Y3 = r * (V - X3) - Y3 - Y3;
333 #ifdef PROFILE_OP_COUNTS
360 eightC = eightC + eightC;
361 eightC = eightC + eightC;
375 (this->
Z).Frobenius_map(1));
418 twist_frob_untwist_x.
coeffs[0],
472 return zero() == h1_r_p;
530 in.read((
char *)&Y_lsb, 1);
553 #ifdef NO_PT_COMPRESSION
563 #ifdef NO_PT_COMPRESSION
571 std::vector<bls12_377_G2> &vec)
573 std::vector<bls12_377_Fq2> Z_vec;
574 Z_vec.reserve(vec.size());
576 for (
auto &el : vec) {
577 Z_vec.emplace_back(el.Z);
579 batch_invert<bls12_377_Fq2>(Z_vec);
583 for (
size_t i = 0; i < vec.size(); ++i) {
587 vec[i].X = vec[i].X * Z2;
588 vec[i].Y = vec[i].Y * Z3;
bls12_377_Fq12 bls12_377_g2_untwist_frobenius_twist_v_inverse
static bls12_377_G2 G2_one
bool is_in_safe_subgroup() const
static bls12_377_G2 random_element()
bool is_well_formed() const
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
bls12_377_Fq12 bls12_377_g2_untwist_frobenius_twist_v
static Fp6_3over2_model< n, modulus > zero()
static const Fp2_model< n, modulus > & one()
static void read_uncompressed(std::istream &, bls12_377_G2 &)
void write_compressed(std::ostream &) const
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static const bls12_377_G2 & one()
static bigint< h_limbs > h
bls12_377_Fq2 bls12_377_twist_coeff_b
bls12_377_Fq12 bls12_377_g2_untwist_frobenius_twist_w_3
bls12_377_G2 add(const bls12_377_G2 &other) const
bls12_377_Fq2 bls12_377_twist_mul_by_q_X
void to_affine_coordinates()
Fp2_model inverse() const
static std::vector< size_t > fixed_base_exp_window_table
Fp12_2over3over2_model Frobenius_map(unsigned long power) const
bls12_377_G2 operator+(const bls12_377_G2 &other) const
bls12_377_Fq2 bls12_377_twist_mul_by_q_Y
bigint< bls12_377_r_limbs > bls12_377_g2_mul_by_cofactor_h2_1
Fp2_model< bls12_377_q_limbs, bls12_377_modulus_q > bls12_377_Fq2
Fp6_3over2_model< bls12_377_q_limbs, bls12_377_modulus_q > bls12_377_Fq6
void consume_OUTPUT_SEPARATOR(std::istream &in)
void write_uncompressed(std::ostream &) const
static const mp_size_t num_limbs
bls12_377_G2 mul_by_cofactor() const
bls12_377_Fq bls12_377_twist_mul_by_b_c1
static void batch_to_special_all_non_zeros(std::vector< bls12_377_G2 > &vec)
static const bls12_377_G2 & zero()
Fp6_3over2_model Frobenius_map(unsigned long power) const
bigint< bls12_377_r_limbs > bls12_377_trace_of_frobenius
static bls12_377_G2 G2_zero
bigint< n > as_bigint() const
bls12_377_G2 mul_by_q() const
bls12_377_Fq12 bls12_377_g2_untwist_frobenius_twist_w_3_inverse
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
bool operator!=(const bls12_377_G2 &other) const
static bls12_377_Fq2 mul_by_b(const bls12_377_Fq2 &elt)
void print_coordinates() const
Fp2_model squared() const
default is squared_complex
static bls12_377_Fq2 coeff_b
static bls12_377_Fq2 coeff_a
Fp2_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
bigint< bls12_377_r_limbs > bls12_377_g2_mul_by_cofactor_h2_0
static const Fp2_model< n, modulus > & zero()
static std::vector< size_t > wnaf_window_table
static void read_compressed(std::istream &, bls12_377_G2 &)
bls12_377_G2 operator-() const
bls12_377_Fq bls12_377_twist_mul_by_b_c0
bls12_377_G2 untwist_frobenius_twist() const
bls12_377_G2 mixed_add(const bls12_377_G2 &other) const
bool operator==(const bls12_377_G2 &other) const