Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
pairing_checks.hpp
Go to the documentation of this file.
1 
18 #ifndef PAIRING_CHECKS_HPP_
19 #define PAIRING_CHECKS_HPP_
20 
22 
23 #include <memory>
24 
25 namespace libsnark
26 {
27 
28 template<typename ppT>
29 class check_e_equals_e_gadget : public gadget<libff::Fr<ppT>>
30 {
31 public:
32  typedef libff::Fr<ppT> FieldT;
33 
34  std::shared_ptr<Fqk_variable<ppT>> ratio;
35  std::shared_ptr<e_over_e_miller_loop_gadget<ppT>> compute_ratio;
36  std::shared_ptr<final_exp_gadget<ppT>> check_finexp;
37 
42 
44 
52  const std::string &annotation_prefix);
53 
55 
56  void generate_r1cs_witness();
57 };
58 
59 template<typename ppT>
60 class check_e_equals_ee_gadget : public gadget<libff::Fr<ppT>>
61 {
62 public:
63  typedef libff::Fr<ppT> FieldT;
64 
65  std::shared_ptr<Fqk_variable<ppT>> ratio;
66  std::shared_ptr<e_times_e_over_e_miller_loop_gadget<ppT>> compute_ratio;
67  std::shared_ptr<final_exp_gadget<ppT>> check_finexp;
68 
75 
77 
87  const std::string &annotation_prefix);
88 
90 
91  void generate_r1cs_witness();
92 };
93 
94 template<typename ppT>
95 class check_e_equals_eee_gadget : public gadget<libff::Fr<ppT>>
96 {
97 public:
98  typedef libff::Fr<ppT> FieldT;
99 
100  std::shared_ptr<Fqk_variable<ppT>> ratio;
101  std::shared_ptr<e_times_e_times_e_over_e_miller_loop_gadget<ppT>>
103  std::shared_ptr<final_exp_gadget<ppT>> check_finexp;
104 
113 
115 
127  const std::string &annotation_prefix);
128 
130  void generate_r1cs_witness();
131 };
132 
133 } // namespace libsnark
134 
136 
137 #endif // PAIRING_CHECKS_HPP_
libsnark::check_e_equals_e_gadget::lhs_G2
G2_precomputation< ppT > lhs_G2
Definition: pairing_checks.hpp:39
libsnark::gadget< libff::Fr< ppT > >::annotation_prefix
const std::string annotation_prefix
Definition: gadget.hpp:20
libsnark::check_e_equals_eee_gadget::compute_ratio
std::shared_ptr< e_times_e_times_e_over_e_miller_loop_gadget< ppT > > compute_ratio
Definition: pairing_checks.hpp:102
libsnark::check_e_equals_ee_gadget::ratio
std::shared_ptr< Fqk_variable< ppT > > ratio
Definition: pairing_checks.hpp:65
libsnark
Definition: accumulation_vector.hpp:18
libsnark::check_e_equals_ee_gadget::compute_ratio
std::shared_ptr< e_times_e_over_e_miller_loop_gadget< ppT > > compute_ratio
Definition: pairing_checks.hpp:66
libsnark::check_e_equals_ee_gadget::rhs2_G2
G2_precomputation< ppT > rhs2_G2
Definition: pairing_checks.hpp:74
libsnark::check_e_equals_e_gadget::check_finexp
std::shared_ptr< final_exp_gadget< ppT > > check_finexp
Definition: pairing_checks.hpp:36
libsnark::check_e_equals_ee_gadget
Definition: pairing_checks.hpp:60
libsnark::check_e_equals_eee_gadget::result
pb_variable< FieldT > result
Definition: pairing_checks.hpp:114
libsnark::check_e_equals_ee_gadget::check_finexp
std::shared_ptr< final_exp_gadget< ppT > > check_finexp
Definition: pairing_checks.hpp:67
libsnark::gadget< libff::Fr< ppT > >::pb
protoboard< libff::Fr< ppT > > & pb
Definition: gadget.hpp:19
libsnark::check_e_equals_eee_gadget::ratio
std::shared_ptr< Fqk_variable< ppT > > ratio
Definition: pairing_checks.hpp:100
libsnark::check_e_equals_e_gadget::compute_ratio
std::shared_ptr< e_over_e_miller_loop_gadget< ppT > > compute_ratio
Definition: pairing_checks.hpp:35
libsnark::check_e_equals_e_gadget::result
pb_variable< FieldT > result
Definition: pairing_checks.hpp:43
libsnark::check_e_equals_ee_gadget::lhs_G2
G2_precomputation< ppT > lhs_G2
Definition: pairing_checks.hpp:70
libsnark::G1_precomputation
typename pairing_selector< ppT >::G1_precomputation_type G1_precomputation
Definition: pairing_params.hpp:127
libsnark::check_e_equals_ee_gadget::rhs1_G1
G1_precomputation< ppT > rhs1_G1
Definition: pairing_checks.hpp:71
libsnark::check_e_equals_e_gadget::rhs_G1
G1_precomputation< ppT > rhs_G1
Definition: pairing_checks.hpp:40
libsnark::check_e_equals_eee_gadget
Definition: pairing_checks.hpp:95
libsnark::gadget
Definition: gadget.hpp:16
libsnark::check_e_equals_ee_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::check_e_equals_e_gadget::rhs_G2
G2_precomputation< ppT > rhs_G2
Definition: pairing_checks.hpp:41
libsnark::check_e_equals_ee_gadget::rhs1_G2
G2_precomputation< ppT > rhs1_G2
Definition: pairing_checks.hpp:72
libsnark::check_e_equals_eee_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::check_e_equals_e_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: pairing_checks.hpp:32
libsnark::check_e_equals_eee_gadget::lhs_G1
G1_precomputation< ppT > lhs_G1
Definition: pairing_checks.hpp:105
libsnark::check_e_equals_e_gadget::ratio
std::shared_ptr< Fqk_variable< ppT > > ratio
Definition: pairing_checks.hpp:34
libsnark::check_e_equals_eee_gadget::check_e_equals_eee_gadget
check_e_equals_eee_gadget(protoboard< FieldT > &pb, const G1_precomputation< ppT > &lhs_G1, const G2_precomputation< ppT > &lhs_G2, const G1_precomputation< ppT > &rhs1_G1, const G2_precomputation< ppT > &rhs1_G2, const G1_precomputation< ppT > &rhs2_G1, const G2_precomputation< ppT > &rhs2_G2, const G1_precomputation< ppT > &rhs3_G1, const G2_precomputation< ppT > &rhs3_G2, const pb_variable< FieldT > &result, const std::string &annotation_prefix)
libsnark::check_e_equals_eee_gadget::rhs1_G1
G1_precomputation< ppT > rhs1_G1
Definition: pairing_checks.hpp:107
libsnark::check_e_equals_ee_gadget::result
pb_variable< FieldT > result
Definition: pairing_checks.hpp:76
libsnark::check_e_equals_ee_gadget::generate_r1cs_witness
void generate_r1cs_witness()
pairing_params.hpp
libsnark::check_e_equals_ee_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: pairing_checks.hpp:63
libsnark::check_e_equals_e_gadget::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::check_e_equals_eee_gadget::rhs3_G2
G2_precomputation< ppT > rhs3_G2
Definition: pairing_checks.hpp:112
libsnark::check_e_equals_e_gadget::lhs_G1
G1_precomputation< ppT > lhs_G1
Definition: pairing_checks.hpp:38
libsnark::check_e_equals_eee_gadget::check_finexp
std::shared_ptr< final_exp_gadget< ppT > > check_finexp
Definition: pairing_checks.hpp:103
libsnark::check_e_equals_eee_gadget::rhs1_G2
G2_precomputation< ppT > rhs1_G2
Definition: pairing_checks.hpp:108
libsnark::pb_variable
Definition: pb_variable.hpp:24
libsnark::check_e_equals_ee_gadget::rhs2_G1
G1_precomputation< ppT > rhs2_G1
Definition: pairing_checks.hpp:73
libsnark::check_e_equals_eee_gadget::rhs2_G2
G2_precomputation< ppT > rhs2_G2
Definition: pairing_checks.hpp:110
libsnark::check_e_equals_eee_gadget::generate_r1cs_witness
void generate_r1cs_witness()
pairing_checks.tcc
libsnark::check_e_equals_e_gadget::check_e_equals_e_gadget
check_e_equals_e_gadget(protoboard< FieldT > &pb, const G1_precomputation< ppT > &lhs_G1, const G2_precomputation< ppT > &lhs_G2, const G1_precomputation< ppT > &rhs_G1, const G2_precomputation< ppT > &rhs_G2, const pb_variable< FieldT > &result, const std::string &annotation_prefix)
libsnark::G2_precomputation
typename pairing_selector< ppT >::G2_precomputation_type G2_precomputation
Definition: pairing_params.hpp:131
libsnark::check_e_equals_ee_gadget::check_e_equals_ee_gadget
check_e_equals_ee_gadget(protoboard< FieldT > &pb, const G1_precomputation< ppT > &lhs_G1, const G2_precomputation< ppT > &lhs_G2, const G1_precomputation< ppT > &rhs1_G1, const G2_precomputation< ppT > &rhs1_G2, const G1_precomputation< ppT > &rhs2_G1, const G2_precomputation< ppT > &rhs2_G2, const pb_variable< FieldT > &result, const std::string &annotation_prefix)
libsnark::check_e_equals_eee_gadget::lhs_G2
G2_precomputation< ppT > lhs_G2
Definition: pairing_checks.hpp:106
libsnark::check_e_equals_e_gadget
Definition: pairing_checks.hpp:29
libsnark::check_e_equals_eee_gadget::rhs3_G1
G1_precomputation< ppT > rhs3_G1
Definition: pairing_checks.hpp:111
libsnark::check_e_equals_e_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::check_e_equals_eee_gadget::rhs2_G1
G1_precomputation< ppT > rhs2_G1
Definition: pairing_checks.hpp:109
libsnark::check_e_equals_ee_gadget::lhs_G1
G1_precomputation< ppT > lhs_G1
Definition: pairing_checks.hpp:69
libsnark::check_e_equals_eee_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: pairing_checks.hpp:98
libsnark::protoboard
Definition: pb_variable.hpp:22