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 edwards_G1::add_cnt = 0;
15 long long edwards_G1::dbl_cnt = 0;
52 "(%Nd : %Nd : %Nd)\n",
55 this->Y.as_bigint().data,
57 this->Z.as_bigint().data,
75 this->
X = tX * tZ_inv;
76 this->Y = tY * tZ_inv;
92 this->
X = this->
X * Z_inv;
93 this->
Y = this->
Y * Z_inv;
97 assert((*
this) == copy);
108 return (this->
Y.
is_zero() && this->Z.is_zero());
124 if ((this->
X * other.
Z) != (other.
X * this->Z)) {
129 if ((this->
Y * other.
Z) != (other.
Y * this->Z)) {
152 return this->
add(other);
162 return (*
this) + (-other);
167 #ifdef PROFILE_OP_COUNTS
199 #ifdef PROFILE_OP_COUNTS
244 #ifdef PROFILE_OP_COUNTS
332 #ifdef USE_MIXED_ADDITION
346 in.read((
char *)&Y_lsb, 1);
354 if ((tY.
as_bigint().data[0] & 1) != Y_lsb) {
363 #ifdef USE_MIXED_ADDITION
370 #ifdef NO_PT_COMPRESSION
380 #ifdef NO_PT_COMPRESSION
390 std::vector<edwards_Fq> Z_vec;
391 Z_vec.reserve(vec.size());
393 for (
auto &el : vec) {
394 Z_vec.emplace_back(el.Z);
396 batch_invert<edwards_Fq>(Z_vec);
400 for (
size_t i = 0; i < vec.size(); ++i) {
401 vec[i].X = vec[i].X * Z_vec[i];
402 vec[i].Y = vec[i].Y * Z_vec[i];
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
static std::vector< size_t > wnaf_window_table
edwards_G1 operator-() const
bool is_well_formed() const
static const Fp_model< n, modulus > & zero()
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static edwards_G1 G1_zero
static const edwards_G1 & one()
static void read_compressed(std::istream &, edwards_G1 &)
Fp_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
static const Fp_model< n, modulus > & one()
edwards_G1 add(const edwards_G1 &other) const
bool operator==(const edwards_G1 &other) const
static edwards_G1 random_element()
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
static std::vector< size_t > fixed_base_exp_window_table
edwards_Fq edwards_coeff_d
static void read_uncompressed(std::istream &, edwards_G1 &)
bigint< n > as_bigint() const
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
void print_coordinates() const
void write_uncompressed(std::ostream &) const
bool operator!=(const edwards_G1 &other) const
edwards_G1 mixed_add(const edwards_G1 &other) const
static const edwards_G1 & zero()
edwards_G1 operator+(const edwards_G1 &other) const
static void batch_to_special_all_non_zeros(std::vector< edwards_G1 > &vec)
void to_affine_coordinates()
void write_compressed(std::ostream &) const