Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
Go to the documentation of this file.
25 this->
P[0] == other.
P[0] && this->P[1] == other.
P[1] &&
26 this->P[2] == other.
P[2]);
31 for (
size_t i = 0; i < 3; ++i) {
33 out << prec_P.
P[i] <<
"\n";
35 out.write((
char *)&prec_P.
P[i],
sizeof(prec_P.
P[i]));
43 for (
size_t i = 0; i < 3; ++i) {
48 in.read((
char *)&prec_P.
P[i],
sizeof(prec_P.
P[i]));
56 if (!(this->
Q[0] == other.
Q[0] && this->Q[1] == other.
Q[1] &&
57 this->Q[2] == other.
Q[2] &&
58 this->coeffs.size() == other.
coeffs.size())) {
63 for (
size_t i = 0; i < this->
coeffs.size(); ++i) {
64 std::stringstream this_ss, other_ss;
65 this_ss << this->
coeffs[i];
66 other_ss << other.
coeffs[i];
67 if (this_ss.str() != other_ss.str()) {
77 for (
size_t i = 0; i < 3; ++i) {
79 out << prec_Q.
Q[i].a_ <<
"\n";
80 out << prec_Q.
Q[i].b_ <<
"\n";
82 out.write((
char *)&prec_Q.
Q[i].a_,
sizeof(prec_Q.
Q[i].a_));
83 out.write((
char *)&prec_Q.
Q[i].b_,
sizeof(prec_Q.
Q[i].b_));
87 out << prec_Q.
coeffs.size() <<
"\n";
89 for (
size_t i = 0; i < prec_Q.
coeffs.size(); ++i) {
91 out << prec_Q.
coeffs[i].a_.a_ <<
"\n";
92 out << prec_Q.
coeffs[i].a_.b_ <<
"\n";
93 out << prec_Q.
coeffs[i].b_.a_ <<
"\n";
94 out << prec_Q.
coeffs[i].b_.b_ <<
"\n";
95 out << prec_Q.
coeffs[i].c_.a_ <<
"\n";
96 out << prec_Q.
coeffs[i].c_.b_ <<
"\n";
99 (
char *)&prec_Q.
coeffs[i].a_.a_,
sizeof(prec_Q.
coeffs[i].a_.a_));
101 (
char *)&prec_Q.
coeffs[i].a_.b_,
sizeof(prec_Q.
coeffs[i].a_.b_));
103 (
char *)&prec_Q.
coeffs[i].b_.a_,
sizeof(prec_Q.
coeffs[i].b_.a_));
105 (
char *)&prec_Q.
coeffs[i].b_.b_,
sizeof(prec_Q.
coeffs[i].b_.b_));
107 (
char *)&prec_Q.
coeffs[i].c_.a_,
sizeof(prec_Q.
coeffs[i].c_.a_));
109 (
char *)&prec_Q.
coeffs[i].c_.b_,
sizeof(prec_Q.
coeffs[i].c_.b_));
118 for (
size_t i = 0; i < 3; ++i) {
119 #ifndef BINARY_OUTPUT
120 in >> prec_Q.
Q[i].a_;
122 in >> prec_Q.
Q[i].b_;
125 in.read((
char *)&prec_Q.
Q[i].a_,
sizeof(prec_Q.
Q[i].a_));
126 in.read((
char *)&prec_Q.
Q[i].b_,
sizeof(prec_Q.
Q[i].b_));
133 prec_Q.
coeffs.resize(count);
134 for (
size_t i = 0; i < count; ++i) {
135 #ifndef BINARY_OUTPUT
136 in >> prec_Q.
coeffs[i].a_.a_;
138 in >> prec_Q.
coeffs[i].a_.b_;
140 in >> prec_Q.
coeffs[i].b_.a_;
142 in >> prec_Q.
coeffs[i].b_.b_;
144 in >> prec_Q.
coeffs[i].c_.a_;
146 in >> prec_Q.
coeffs[i].c_.b_;
150 (
char *)&prec_Q.
coeffs[i].a_.a_,
sizeof(prec_Q.
coeffs[i].a_.a_));
152 (
char *)&prec_Q.
coeffs[i].a_.b_,
sizeof(prec_Q.
coeffs[i].a_.b_));
154 (
char *)&prec_Q.
coeffs[i].b_.a_,
sizeof(prec_Q.
coeffs[i].b_.a_));
156 (
char *)&prec_Q.
coeffs[i].b_.b_,
sizeof(prec_Q.
coeffs[i].b_.b_));
158 (
char *)&prec_Q.
coeffs[i].c_.a_,
sizeof(prec_Q.
coeffs[i].c_.a_));
160 (
char *)&prec_Q.
coeffs[i].c_.b_,
sizeof(prec_Q.
coeffs[i].c_.b_));
173 bn::ecop::NormalizeJac(result.
P, P_coord);
186 bn::components::precomputeG2(result.
coeffs, result.
Q, Q_coord);
196 bn::components::millerLoop(f.
elem, prec_Q.
coeffs, prec_P.
P);
207 bn::components::millerLoop2(
216 eltcopy.
elem.final_exp();
void enter_block(const std::string &msg, const bool indent)
void fill_coord(bn::Fp2 coord[3]) const
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
std::vector< bn128_ate_ell_coeffs > coeffs
bn128_ate_G1_precomp bn128_ate_precompute_G1(const bn128_G1 &P)
bool operator==(const bn128_ate_G2_precomp &other) const
bool operator==(const bn128_ate_G1_precomp &other) const
bn128_ate_G2_precomp bn128_ate_precompute_G2(const bn128_G2 &Q)
bn128_GT bn128_final_exponentiation(const bn128_Fq12 &elt)
bn128_Fq12 bn128_double_ate_miller_loop(const bn128_ate_G1_precomp &prec_P1, const bn128_ate_G2_precomp &prec_Q1, const bn128_ate_G1_precomp &prec_P2, const bn128_ate_G2_precomp &prec_Q2)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
void fill_coord(bn::Fp coord[3]) const
void leave_block(const std::string &msg, const bool indent)
bn128_Fq12 bn128_ate_miller_loop(const bn128_ate_G1_precomp &prec_P, const bn128_ate_G2_precomp &prec_Q)
void consume_newline(std::istream &in)