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_G1::add_cnt = 0;
15 long long bls12_377_G1::dbl_cnt = 0;
55 "(%Nd : %Nd : %Nd)\n",
58 this->Y.as_bigint().data,
60 this->Z.as_bigint().data,
75 this->
X = this->
X * Z2_inv;
76 this->
Y = this->
Y * Z3_inv;
108 if (((this->
X * Z2_squared) != (other.
X * Z1_squared)) ||
109 ((this->
Y * Z2_cubed) != (other.
Y * Z1_cubed))) {
152 if (U1 == U2 && S1 == S2) {
175 bls12_377_Fq Z3 = ((this->
Z + other.
Z).squared() - Z1Z1 - Z2Z2) * H;
187 return (*
this) + (-other);
205 if (this->
operator==(other)) {
209 #ifdef PROFILE_OP_COUNTS
243 bls12_377_Fq Z3 = ((this->
Z + other.
Z).squared() - Z1Z1 - Z2Z2) * H;
277 if (this->
X == U2 && this->
Y == S2) {
281 #ifdef PROFILE_OP_COUNTS
305 Y3 = r * (V - X3) - Y3 - Y3;
314 #ifdef PROFILE_OP_COUNTS
344 eightC = eightC + eightC;
345 eightC = eightC + eightC;
396 return zero() == r_times_g;
468 in.read((
char *)&Y_lsb, 1);
477 if ((tY.
as_bigint().data[0] & 1) != Y_lsb) {
494 #ifdef NO_PT_COMPRESSION
504 #ifdef NO_PT_COMPRESSION
513 std::vector<bls12_377_G1> &vec)
515 std::vector<bls12_377_Fq> Z_vec;
516 Z_vec.reserve(vec.size());
518 for (
auto &el : vec) {
519 Z_vec.emplace_back(el.Z);
521 batch_invert<bls12_377_Fq>(Z_vec);
525 for (
size_t i = 0; i < vec.size(); ++i) {
529 vec[i].X = vec[i].X * Z2;
530 vec[i].Y = vec[i].Y * Z3;
static bls12_377_Fq coeff_b
static bls12_377_G1 G1_zero
void write_compressed(std::ostream &) const
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
bool is_in_safe_subgroup() const
static const bls12_377_G1 & zero()
bls12_377_G1 sigma() const
static const Fp_model< n, modulus > & zero()
void write_uncompressed(std::ostream &) const
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static bls12_377_Fq coeff_a
bls12_377_Fq bls12_377_coeff_b
static bls12_377_G1 random_element()
bls12_377_G1 mixed_add(const bls12_377_G1 &other) const
Fp_model< bls12_377_q_limbs, bls12_377_modulus_q > bls12_377_Fq
bigint< bls12_377_r_limbs > bls12_377_g1_safe_subgroup_check_c1
bls12_377_G1 operator+(const bls12_377_G1 &other) const
bool operator==(const bls12_377_G1 &other) const
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
static const Fp_model< n, modulus > & one()
bls12_377_Fq bls12_377_g1_proof_of_safe_subgroup_non_member_y
void to_affine_coordinates()
static std::vector< size_t > wnaf_window_table
void print_coordinates() const
bls12_377_Fq bls12_377_g1_proof_of_safe_subgroup_non_member_x
bool operator!=(const bls12_377_G1 &other) const
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
bigint< bls12_377_r_limbs > bls12_377_g1_proof_of_safe_subgroup_w
bls12_377_G1 mul_by_cofactor() const
bool is_well_formed() const
static void read_uncompressed(std::istream &, bls12_377_G1 &)
bigint< n > as_bigint() const
static void batch_to_special_all_non_zeros(std::vector< bls12_377_G1 > &vec)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
static const bls12_377_G1 & one()
static bls12_377_G1 G1_one
static void read_compressed(std::istream &, bls12_377_G1 &)
bls12_377_G1 add(const bls12_377_G1 &other) const
static std::vector< size_t > fixed_base_exp_window_table
static bigint< h_limbs > h
bls12_377_G1 proof_of_safe_subgroup() const
bls12_377_G1 operator-() const
bls12_377_Fq bls12_377_g1_endomorphism_beta