Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
edwards_g1.hpp
Go to the documentation of this file.
1
8#ifndef EDWARDS_G1_HPP_
9#define EDWARDS_G1_HPP_
10#include <vector>
11
14
15namespace libff {
16
17class edwards_G1;
18std::ostream& operator<<(std::ostream &, const edwards_G1&);
19std::istream& operator>>(std::istream &, edwards_G1&);
20
22public:
23#ifdef PROFILE_OP_COUNTS
24 static long long add_cnt;
25 static long long dbl_cnt;
26#endif
27 static std::vector<size_t> wnaf_window_table;
28 static std::vector<size_t> fixed_base_exp_window_table;
31 static bool initialized;
32
34 edwards_G1();
35private:
36 edwards_G1(const edwards_Fq& X, const edwards_Fq& Y, const edwards_Fq& Z) : X(X), Y(Y), Z(Z) {};
37
38public:
41 // using inverted coordinates
42 edwards_G1(const edwards_Fq& X, const edwards_Fq& Y) : X(Y), Y(X), Z(X*Y) {};
43
44 void print() const;
45 void print_coordinates() const;
46
48 void to_special();
49 bool is_special() const;
50
51 bool is_zero() const;
52
53 bool operator==(const edwards_G1 &other) const;
54 bool operator!=(const edwards_G1 &other) const;
55
56 edwards_G1 operator+(const edwards_G1 &other) const;
57 edwards_G1 operator-() const;
58 edwards_G1 operator-(const edwards_G1 &other) const;
59
60 edwards_G1 add(const edwards_G1 &other) const;
61 edwards_G1 mixed_add(const edwards_G1 &other) const;
62 edwards_G1 dbl() const;
63
64 bool is_well_formed() const;
65
66 static edwards_G1 zero();
67 static edwards_G1 one();
69
70 static size_t size_in_bits() { return edwards_Fq::size_in_bits() + 1; }
73
74 friend std::ostream& operator<<(std::ostream &out, const edwards_G1 &g);
75 friend std::istream& operator>>(std::istream &in, edwards_G1 &g);
76
77 static void batch_to_special_all_non_zeros(std::vector<edwards_G1> &vec);
78};
79
80template<mp_size_t m>
82{
83 return scalar_mul<edwards_G1, m>(rhs, lhs);
84}
85
86template<mp_size_t m, const bigint<m>& modulus_p>
88{
89 return scalar_mul<edwards_G1, m>(rhs, lhs.as_bigint());
90}
91
92std::ostream& operator<<(std::ostream& out, const std::vector<edwards_G1> &v);
93std::istream& operator>>(std::istream& in, std::vector<edwards_G1> &v);
94
95} // libff
96#endif // EDWARDS_G1_HPP_
bigint< n > as_bigint() const
edwards_G1 add(const edwards_G1 &other) const
edwards_G1(const edwards_Fq &X, const edwards_Fq &Y)
void print_coordinates() const
static size_t size_in_bits()
edwards_G1 operator-() const
friend std::ostream & operator<<(std::ostream &out, const edwards_G1 &g)
void to_affine_coordinates()
bool is_well_formed() const
static std::vector< size_t > fixed_base_exp_window_table
edwards_Fr scalar_field
static bool initialized
friend std::istream & operator>>(std::istream &in, edwards_G1 &g)
static edwards_G1 one()
bool is_zero() const
static edwards_G1 zero()
edwards_Fq base_field
edwards_G1 operator+(const edwards_G1 &other) const
static edwards_G1 G1_one
static void batch_to_special_all_non_zeros(std::vector< edwards_G1 > &vec)
static edwards_G1 random_element()
bool is_special() const
bool operator==(const edwards_G1 &other) const
edwards_G1 mixed_add(const edwards_G1 &other) const
void print() const
static edwards_G1 G1_zero
static bigint< base_field::num_limbs > base_field_char()
bool operator!=(const edwards_G1 &other) const
edwards_G1 dbl() const
static std::vector< size_t > wnaf_window_table
static bigint< scalar_field::num_limbs > order()
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
GroupT scalar_mul(const GroupT &base, const bigint< m > &scalar)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
alt_bn128_G1 operator*(const bigint< m > &lhs, const alt_bn128_G1 &rhs)
Definition lib.h:43