Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
Go to the documentation of this file.
6 #ifdef PROFILE_OP_COUNTS
7 long long bls12_381_G1::add_cnt = 0;
8 long long bls12_381_G1::dbl_cnt = 0;
48 "(%Nd : %Nd : %Nd)\n",
51 this->Y.as_bigint().data,
53 this->Z.as_bigint().data,
68 this->
X = this->
X * Z2_inv;
69 this->
Y = this->
Y * Z3_inv;
103 if (((this->
X * Z2_squared) != (other.
X * Z1_squared)) ||
104 ((this->
Y * Z2_cubed) != (other.
Y * Z1_cubed))) {
151 if (U1 == U2 && S1 == S2) {
174 bls12_381_Fq Z3 = ((this->
Z + other.
Z).squared() - Z1Z1 - Z2Z2) * H;
186 return (*
this) + (-other);
191 return (*
this) + other;
229 if (this->
X == U2 && this->
Y == S2) {
234 #ifdef PROFILE_OP_COUNTS
258 Y3 = r * (V - X3) - Y3 - Y3;
267 #ifdef PROFILE_OP_COUNTS
297 eightC = eightC + eightC;
298 eightC = eightC + eightC;
397 in.read((
char *)&Y_lsb, 1);
406 if ((tY.
as_bigint().data[0] & 1) != Y_lsb) {
423 #ifdef NO_PT_COMPRESSION
433 #ifdef NO_PT_COMPRESSION
442 std::vector<bls12_381_G1> &vec)
444 std::vector<bls12_381_Fq> Z_vec;
445 Z_vec.reserve(vec.size());
447 for (
auto &el : vec) {
448 Z_vec.emplace_back(el.Z);
450 batch_invert<bls12_381_Fq>(Z_vec);
454 for (
size_t i = 0; i < vec.size(); ++i) {
458 vec[i].X = vec[i].X * Z2;
459 vec[i].Y = vec[i].Y * Z3;
bool is_well_formed() const
static bls12_381_Fq coeff_a
bls12_381_G1 mixed_add(const bls12_381_G1 &other) const
bls12_381_G1 add(const bls12_381_G1 &other) const
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
static bigint< h_limbs > h
static const bls12_381_G1 & one()
static std::vector< std::size_t > wnaf_window_table
Fp_model< bls12_381_q_limbs, bls12_381_modulus_q > bls12_381_Fq
static const Fp_model< n, modulus > & zero()
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static std::vector< std::size_t > fixed_base_exp_window_table
bool operator==(const bls12_381_G1 &other) const
bls12_381_G1 operator-() const
static const bls12_381_G1 & zero()
bls12_381_G1 mul_by_cofactor() const
static bls12_381_G1 random_element()
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
static const Fp_model< n, modulus > & one()
static bls12_381_G1 G1_one
static void batch_to_special_all_non_zeros(std::vector< bls12_381_G1 > &vec)
static void read_uncompressed(std::istream &, bls12_381_G1 &)
bls12_381_G1 operator+(const bls12_381_G1 &other) const
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
void to_affine_coordinates()
bool operator!=(const bls12_381_G1 &other) const
void print_coordinates() const
static bls12_381_G1 G1_zero
bigint< n > as_bigint() const
static bls12_381_Fq coeff_b
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
static void read_compressed(std::istream &, bls12_381_G1 &)
void write_uncompressed(std::ostream &) const
bls12_381_Fq bls12_381_coeff_b
static const constexpr bigint< n > & mod
void write_compressed(std::ostream &) const
bool is_in_safe_subgroup() const