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 bw6_761_G2::add_cnt = 0;
8 long long bw6_761_G2::dbl_cnt = 0;
53 "(%Nd : %Nd : %Nd)\n",
56 this->Y.as_bigint().data,
58 this->Z.as_bigint().data,
71 this->
X = this->
X * Z_inv;
72 this->
Y = this->
Y * Z_inv;
86 return (this->
X.
is_zero() && this->Z.is_zero());
103 if (((this->
X * other.
Z) != (other.
X * this->Z)) ||
104 ((this->Y * other.
Z) != (other.
Y * this->Z))) {
143 if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
190 const bw6_761_Fq A = uu * Z1Z2 - (vvv + R + R);
194 const bw6_761_Fq Y3 = u * (R - A) - vvv * Y1Z2;
208 return (*
this) + (-other);
226 if (this->
operator==(other)) {
230 #ifdef PROFILE_OP_COUNTS
255 const bw6_761_Fq A = uu * Z1Z2 - (vvv + R + R);
259 const bw6_761_Fq Y3 = u * (R - A) - vvv * Y1Z2;
290 if (this->
X == X2Z1 && this->
Y == Y2Z1) {
294 #ifdef PROFILE_OP_COUNTS
326 #ifdef PROFILE_OP_COUNTS
429 #ifdef NO_PT_COMPRESSION
466 in.read((
char *)&Y_lsb, 1);
476 if ((tY.
as_bigint().data[0] & 1) != Y_lsb) {
490 #ifdef NO_PT_COMPRESSION
500 std::vector<bw6_761_Fq> Z_vec;
501 Z_vec.reserve(vec.size());
503 for (
auto &el : vec) {
504 Z_vec.emplace_back(el.Z);
506 batch_invert<bw6_761_Fq>(Z_vec);
510 for (
size_t i = 0; i < vec.size(); ++i) {
511 vec[i].X = vec[i].X * Z_vec[i];
512 vec[i].Y = vec[i].Y * Z_vec[i];
void print_coordinates() const
static bw6_761_G2 G2_zero
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
bw6_761_G2 mul_by_cofactor() const
void to_affine_coordinates()
Fp_model< bw6_761_q_limbs, bw6_761_modulus_q > bw6_761_Fq
static const Fp_model< n, modulus > & zero()
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
bool operator!=(const bw6_761_G2 &other) const
static const bw6_761_G2 & one()
static bigint< base_field::num_limbs > base_field_char()
bool operator==(const bw6_761_G2 &other) const
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
static const Fp_model< n, modulus > & one()
static bw6_761_G2 random_element()
static void read_uncompressed(std::istream &, bw6_761_G2 &)
static bw6_761_Fq coeff_b
bool is_well_formed() const
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
static const bw6_761_G2 & zero()
static void read_compressed(std::istream &, bw6_761_G2 &)
static std::vector< size_t > fixed_base_exp_window_table
static bigint< h_limbs > h
bigint< n > as_bigint() const
void write_compressed(std::ostream &) const
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
static bw6_761_Fq coeff_a
static bw6_761_Fq mul_by_b(const bw6_761_Fq &elt)
bw6_761_G2 add(const bw6_761_G2 &other) const
bw6_761_Fq bw6_761_twist_coeff_b
bool is_in_safe_subgroup() const
bw6_761_G2 operator-() const
static const constexpr bigint< n > & mod
static void batch_to_special_all_non_zeros(std::vector< bw6_761_G2 > &vec)
bw6_761_G2 operator+(const bw6_761_G2 &other) const
void write_uncompressed(std::ostream &) const
static std::vector< size_t > wnaf_window_table
bw6_761_G2 mul_by_q() const
bw6_761_G2 mixed_add(const bw6_761_G2 &other) const