Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
libff::bn128_ate_G2_precomp Struct Reference

#include <bn128_pairing.hpp>

Public Member Functions

bool operator== (const bn128_ate_G2_precomp &other) const
 

Public Attributes

bn::Fp2 Q [3]
 
std::vector< bn128_ate_ell_coeffscoeffs
 

Friends

std::ostream & operator<< (std::ostream &out, const bn128_ate_G2_precomp &prec_Q)
 
std::istream & operator>> (std::istream &in, bn128_ate_G2_precomp &prec_Q)
 

Detailed Description

Definition at line 31 of file bn128_pairing.hpp.

Member Function Documentation

◆ operator==()

bool libff::bn128_ate_G2_precomp::operator== ( const bn128_ate_G2_precomp & other) const

Definition at line 56 of file bn128_pairing.cpp.

57{
58 if (!(this->Q[0] == other.Q[0] &&
59 this->Q[1] == other.Q[1] &&
60 this->Q[2] == other.Q[2] &&
61 this->coeffs.size() == other.coeffs.size()))
62 {
63 return false;
64 }
65
66 /* work around for upstream serialization bug */
67 for (size_t i = 0; i < this->coeffs.size(); ++i)
68 {
69 std::stringstream this_ss, other_ss;
70 this_ss << this->coeffs[i];
71 other_ss << other.coeffs[i];
72 if (this_ss.str() != other_ss.str())
73 {
74 return false;
75 }
76 }
77
78 return true;
79}
std::vector< bn128_ate_ell_coeffs > coeffs

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const bn128_ate_G2_precomp & prec_Q )
friend

Definition at line 81 of file bn128_pairing.cpp.

82{
83 for (size_t i = 0; i < 3; ++i)
84 {
85#ifndef BINARY_OUTPUT
86 out << prec_Q.Q[i].a_ << "\n";
87 out << prec_Q.Q[i].b_ << "\n";
88#else
89 out.write((char*) &prec_Q.Q[i].a_, sizeof(prec_Q.Q[i].a_));
90 out.write((char*) &prec_Q.Q[i].b_, sizeof(prec_Q.Q[i].b_));
91#endif
92 }
93
94 out << prec_Q.coeffs.size() << "\n";
95
96 for (size_t i = 0; i < prec_Q.coeffs.size(); ++i)
97 {
98#ifndef BINARY_OUTPUT
99 out << prec_Q.coeffs[i].a_.a_ << "\n";
100 out << prec_Q.coeffs[i].a_.b_ << "\n";
101 out << prec_Q.coeffs[i].b_.a_ << "\n";
102 out << prec_Q.coeffs[i].b_.b_ << "\n";
103 out << prec_Q.coeffs[i].c_.a_ << "\n";
104 out << prec_Q.coeffs[i].c_.b_ << "\n";
105#else
106 out.write((char*) &prec_Q.coeffs[i].a_.a_, sizeof(prec_Q.coeffs[i].a_.a_));
107 out.write((char*) &prec_Q.coeffs[i].a_.b_, sizeof(prec_Q.coeffs[i].a_.b_));
108 out.write((char*) &prec_Q.coeffs[i].b_.a_, sizeof(prec_Q.coeffs[i].b_.a_));
109 out.write((char*) &prec_Q.coeffs[i].b_.b_, sizeof(prec_Q.coeffs[i].b_.b_));
110 out.write((char*) &prec_Q.coeffs[i].c_.a_, sizeof(prec_Q.coeffs[i].c_.a_));
111 out.write((char*) &prec_Q.coeffs[i].c_.b_, sizeof(prec_Q.coeffs[i].c_.b_));
112#endif
113 }
114
115 return out;
116}

◆ operator>>

std::istream & operator>> ( std::istream & in,
bn128_ate_G2_precomp & prec_Q )
friend

Definition at line 118 of file bn128_pairing.cpp.

119{
120 for (size_t i = 0; i < 3; ++i)
121 {
122#ifndef BINARY_OUTPUT
123 in >> prec_Q.Q[i].a_;
124 consume_newline(in);
125 in >> prec_Q.Q[i].b_;
126 consume_newline(in);
127#else
128 in.read((char*) &prec_Q.Q[i].a_, sizeof(prec_Q.Q[i].a_));
129 in.read((char*) &prec_Q.Q[i].b_, sizeof(prec_Q.Q[i].b_));
130#endif
131 }
132
133 size_t count;
134 in >> count;
135 consume_newline(in);
136 prec_Q.coeffs.resize(count);
137 for (size_t i = 0; i < count; ++i)
138 {
139#ifndef BINARY_OUTPUT
140 in >> prec_Q.coeffs[i].a_.a_;
141 consume_newline(in);
142 in >> prec_Q.coeffs[i].a_.b_;
143 consume_newline(in);
144 in >> prec_Q.coeffs[i].b_.a_;
145 consume_newline(in);
146 in >> prec_Q.coeffs[i].b_.b_;
147 consume_newline(in);
148 in >> prec_Q.coeffs[i].c_.a_;
149 consume_newline(in);
150 in >> prec_Q.coeffs[i].c_.b_;
151 consume_newline(in);
152#else
153 in.read((char*) &prec_Q.coeffs[i].a_.a_, sizeof(prec_Q.coeffs[i].a_.a_));
154 in.read((char*) &prec_Q.coeffs[i].a_.b_, sizeof(prec_Q.coeffs[i].a_.b_));
155 in.read((char*) &prec_Q.coeffs[i].b_.a_, sizeof(prec_Q.coeffs[i].b_.a_));
156 in.read((char*) &prec_Q.coeffs[i].b_.b_, sizeof(prec_Q.coeffs[i].b_.b_));
157 in.read((char*) &prec_Q.coeffs[i].c_.a_, sizeof(prec_Q.coeffs[i].c_.a_));
158 in.read((char*) &prec_Q.coeffs[i].c_.b_, sizeof(prec_Q.coeffs[i].c_.b_));
159#endif
160 }
161 return in;
162}
int * count
void consume_newline(std::istream &in)

Member Data Documentation

◆ coeffs

std::vector<bn128_ate_ell_coeffs> libff::bn128_ate_G2_precomp::coeffs

Definition at line 33 of file bn128_pairing.hpp.

◆ Q

bn::Fp2 libff::bn128_ate_G2_precomp::Q[3]

Definition at line 32 of file bn128_pairing.hpp.


The documentation for this struct was generated from the following files: