Clearmatics Libff  0.1
C++ library for Finite Fields and Elliptic Curves
bn128_gt.hpp
Go to the documentation of this file.
1 
8 #ifndef BN128_GT_HPP_
9 #define BN128_GT_HPP_
10 #include "depends/ate-pairing/include/bn.h"
11 
12 #include <iostream>
15 
16 namespace libff
17 {
18 
19 class bn128_GT;
20 std::ostream &operator<<(std::ostream &, const bn128_GT &);
21 std::istream &operator>>(std::istream &, bn128_GT &);
22 
23 class bn128_GT
24 {
25 public:
26  static bn128_GT GT_one;
27  bn::Fp12 elem;
28 
29  bn128_GT();
30  bool operator==(const bn128_GT &other) const;
31  bool operator!=(const bn128_GT &other) const;
32 
33  bn128_GT operator*(const bn128_GT &other) const;
34  bn128_GT unitary_inverse() const;
35 
36  static bn128_GT one();
37 
38  void print() { std::cout << this->elem << "\n"; };
39 
40  friend std::ostream &operator<<(std::ostream &out, const bn128_GT &g);
41  friend std::istream &operator>>(std::istream &in, bn128_GT &g);
42 };
43 
44 template<mp_size_t m>
45 bn128_GT operator^(const bn128_GT &rhs, const bigint<m> &lhs)
46 {
47  return power<bn128_GT, m>(rhs, lhs);
48 }
49 
50 template<mp_size_t m, const bigint<m> &modulus_p>
52 {
53  return power<bn128_GT, m>(rhs, lhs.as_bigint());
54 }
55 
56 } // namespace libff
57 #endif // BN128_GT_HPP_
libff::bn128_GT
Definition: bn128_gt.hpp:23
libff
Definition: ffi.cpp:8
fp.hpp
libff::operator>>
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
Definition: alt_bn128_g1.cpp:446
libff::bn128_GT::operator==
bool operator==(const bn128_GT &other) const
Definition: bn128_gt.cpp:16
libff::bn128_GT::elem
bn::Fp12 elem
Definition: bn128_gt.hpp:27
libff::bn128_GT::operator*
bn128_GT operator*(const bn128_GT &other) const
Definition: bn128_gt.cpp:26
field_utils.hpp
libff::bn128_GT::bn128_GT
bn128_GT()
Definition: bn128_gt.cpp:14
libff::bigint
Definition: bigint.hpp:20
libff::operator^
bn128_GT operator^(const bn128_GT &rhs, const bigint< m > &lhs)
Definition: bn128_gt.hpp:45
libff::bn128_GT::operator<<
friend std::ostream & operator<<(std::ostream &out, const bn128_GT &g)
Definition: bn128_gt.cpp:42
libff::Fp_model::as_bigint
bigint< n > as_bigint() const
libff::Fp_model
Definition: fp.hpp:20
libff::operator<<
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
Definition: alt_bn128_g1.cpp:436
libff::bn128_GT::one
static bn128_GT one()
Definition: bn128_gt.cpp:40
libff::bn128_GT::operator>>
friend std::istream & operator>>(std::istream &in, bn128_GT &g)
Definition: bn128_gt.cpp:53
libff::bn128_GT::operator!=
bool operator!=(const bn128_GT &other) const
Definition: bn128_gt.cpp:21
libff::bn128_GT::print
void print()
Definition: bn128_gt.hpp:38
libff::bn128_GT::GT_one
static bn128_GT GT_one
Definition: bn128_gt.hpp:26
libff::bn128_GT::unitary_inverse
bn128_GT unitary_inverse() const
Definition: bn128_gt.cpp:33