Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
bn128_gt.cpp
Go to the documentation of this file.
1
9
10namespace libff {
11
12bn128_GT bn128_GT::GT_one;
14{
15 this->elem.clear();
16}
17
18bool bn128_GT::operator==(const bn128_GT &other) const
19{
20 return (this->elem == other.elem);
21}
22
23bool bn128_GT::operator!=(const bn128_GT& other) const
24{
25 return !(operator==(other));
26}
27
29{
30 bn128_GT result;
31 bn::Fp12::mul(result.elem, this->elem, other.elem);
32 return result;
33}
34
36{
37 bn128_GT result(*this);
38 bn::Fp6::neg(result.elem.b_, result.elem.b_);
39 return result;
40}
41
43{
44 return GT_one;
45}
46
47std::ostream& operator<<(std::ostream &out, const bn128_GT &g)
48{
49#ifndef BINARY_OUTPUT
50 out << g.elem.a_ << OUTPUT_SEPARATOR << g.elem.b_;
51#else
52 out.write((char*) &g.elem.a_, sizeof(g.elem.a_));
53 out.write((char*) &g.elem.b_, sizeof(g.elem.b_));
54#endif
55 return out;
56}
57
58std::istream& operator>>(std::istream &in, bn128_GT &g)
59{
60#ifndef BINARY_OUTPUT
61 in >> g.elem.a_;
63 in >> g.elem.b_;
64#else
65 in.read((char*) &g.elem.a_, sizeof(g.elem.a_));
66 in.read((char*) &g.elem.b_, sizeof(g.elem.b_));
67#endif
68 return in;
69}
70} // libff
static bn128_GT one()
Definition bn128_gt.cpp:42
bool operator!=(const bn128_GT &other) const
Definition bn128_gt.cpp:23
bn128_GT unitary_inverse() const
Definition bn128_gt.cpp:35
bool operator==(const bn128_GT &other) const
Definition bn128_gt.cpp:18
static bn128_GT GT_one
Definition bn128_gt.hpp:25
bn::Fp12 elem
Definition bn128_gt.hpp:26
bn128_GT operator*(const bn128_GT &other) const
Definition bn128_gt.cpp:28
#define OUTPUT_SEPARATOR
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
void consume_OUTPUT_SEPARATOR(std::istream &in)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
static void(* mul)(Fp12T &z, const Fp12T &x, const Fp12T &y)
Definition bn.h:1449
Fp6 a_
Definition bn.h:1371
Fp6 b_
Definition bn.h:1371
void clear()
Definition bn.h:1396
static void neg(Fp6T &z, const Fp6T &x)
Definition bn.h:896