Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
bls12_377_miller_loop.hpp
Go to the documentation of this file.
1 
9 #ifndef LIBSNARK_GADGETLIB1_GADGETS_PAIRING_BW6_761_BLS12_377_BLS12_377_MILLER_LOOP_HPP_
10 #define LIBSNARK_GADGETLIB1_GADGETS_PAIRING_BW6_761_BLS12_377_BLS12_377_MILLER_LOOP_HPP_
11 
18 
19 #include <libff/algebra/curves/bls12_377/bls12_377_pp.hpp>
20 
21 namespace libsnark
22 {
23 
30 template<typename ppT>
31 class bls12_377_ate_compute_f_ell_P : public gadget<libff::Fr<ppT>>
32 {
33 public:
34  using FieldT = libff::Fr<ppT>;
35  using FqkT = libff::Fqk<other_curve<ppT>>;
36 
40 
45  const bls12_377_ate_ell_coeffs<ppT> &ell_coeffs,
48  const std::string &annotation_prefix);
49 
52  void generate_r1cs_witness();
53 };
54 
55 template<typename ppT>
56 class bls12_377_miller_loop_gadget : public gadget<libff::Fr<ppT>>
57 {
58 public:
59  using FieldT = libff::Fr<ppT>;
60  using FqeT = libff::Fqe<other_curve<ppT>>;
61  using FqkT = libff::Fqk<other_curve<ppT>>;
62  using Fq6T = typename FqkT::my_Fp6;
63 
65 
66  // Squaring of f
67  std::vector<std::shared_ptr<Fp12_2over3over2_square_gadget<FqkT>>>
69 
70  // f * ell(P) (for both double and add steps)
71  std::vector<std::shared_ptr<bls12_377_ate_compute_f_ell_P<ppT>>> _f_ell_P;
72 
78  const std::string &annotation_prefix);
79 
82  void generate_r1cs_witness();
83 };
84 
85 template<typename ppT>
86 class bls12_377_e_over_e_miller_loop_gadget : public gadget<libff::Fr<ppT>>
87 {
88 public:
89  using FieldT = libff::Fr<ppT>;
90  using FqkT = libff::Fqk<other_curve<ppT>>;
91 
94 
95  // Squaring of f
96  std::vector<std::shared_ptr<Fp12_2over3over2_square_gadget<FqkT>>>
98 
99  // f * ell(P) (for both double and add steps)
100  std::vector<std::shared_ptr<bls12_377_ate_compute_f_ell_P<ppT>>> _f_ell_P;
101 
103  protoboard<libff::Fr<ppT>> &pb,
104  const bls12_377_G1_precomputation<ppT> &P1_prec,
105  const bls12_377_G2_precomputation<ppT> &Q1_prec,
106  const bls12_377_G1_precomputation<ppT> &P2_prec,
107  const bls12_377_G2_precomputation<ppT> &Q2_prec,
108  const Fp12_2over3over2_variable<FqkT> &result,
109  const std::string &annotation_prefix);
111  void generate_r1cs_witness();
112 };
113 
114 template<typename ppT>
116  : public gadget<libff::Fr<ppT>>
117 {
118 public:
119  using FieldT = libff::Fr<ppT>;
120  using FqkT = libff::Fqk<other_curve<ppT>>;
121 
124 
125  // Squaring of f
126  std::vector<std::shared_ptr<Fp12_2over3over2_square_gadget<FqkT>>>
128 
129  // f * ell(P) (for both double and add steps)
130  std::vector<std::shared_ptr<bls12_377_ate_compute_f_ell_P<ppT>>> _f_ell_P;
131 
133  protoboard<libff::Fr<ppT>> &pb,
134  const bls12_377_G1_precomputation<ppT> &P1_prec,
135  const bls12_377_G2_precomputation<ppT> &Q1_prec,
136  const bls12_377_G1_precomputation<ppT> &P2_prec,
137  const bls12_377_G2_precomputation<ppT> &Q2_prec,
138  const bls12_377_G1_precomputation<ppT> &P3_prec,
139  const bls12_377_G2_precomputation<ppT> &Q3_prec,
140  const bls12_377_G1_precomputation<ppT> &P4_prec,
141  const bls12_377_G2_precomputation<ppT> &Q4_prec,
142  const Fp12_2over3over2_variable<FqkT> &result,
143  const std::string &annotation_prefix);
145  void generate_r1cs_witness();
146 };
147 
148 } // namespace libsnark
149 
151 
152 #endif // LIBSNARK_GADGETLIB1_GADGETS_PAIRING_BW6_761_BLS12_377_BLS12_377_MILLER_LOOP_HPP_
libsnark::bls12_377_e_over_e_miller_loop_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: bls12_377_miller_loop.hpp:89
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::bls12_377_ate_compute_f_ell_P::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::bls12_377_e_over_e_miller_loop_gadget
Definition: bls12_377_miller_loop.hpp:86
libsnark::gadget< libff::Fr< ppT > >::annotation_prefix
const std::string annotation_prefix
Definition: gadget.hpp:20
libsnark::bls12_377_ate_compute_f_ell_P::result
const Fp12_2over3over2_variable< FqkT > & result() const
libsnark::bls12_377_e_over_e_miller_loop_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::bls12_377_ate_compute_f_ell_P
Definition: bls12_377_miller_loop.hpp:31
libsnark
Definition: accumulation_vector.hpp:18
libsnark::bls12_377_ate_ell_coeffs
Definition: bls12_377_precomputation.hpp:58
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::_f0
Fp12_2over3over2_variable< FqkT > _f0
Definition: bls12_377_miller_loop.hpp:122
libsnark::bls12_377_ate_compute_f_ell_P::FieldT
libff::Fr< ppT > FieldT
Definition: bls12_377_miller_loop.hpp:34
fp2_gadgets.hpp
libsnark::gadget< libff::Fr< ppT > >::pb
protoboard< libff::Fr< ppT > > & pb
Definition: gadget.hpp:19
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::FqkT
libff::Fqk< other_curve< ppT > > FqkT
Definition: bls12_377_miller_loop.hpp:120
libsnark::bls12_377_miller_loop_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: bls12_377_miller_loop.hpp:119
libsnark::bls12_377_miller_loop_gadget
Definition: bls12_377_miller_loop.hpp:56
libsnark::bls12_377_miller_loop_gadget::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::bls12_377_miller_loop_gadget::_f0
Fp12_2over3over2_variable< FqkT > _f0
Definition: bls12_377_miller_loop.hpp:64
libsnark::bls12_377_e_over_e_miller_loop_gadget::FqkT
libff::Fqk< other_curve< ppT > > FqkT
Definition: bls12_377_miller_loop.hpp:90
libsnark::bls12_377_ate_compute_f_ell_P::bls12_377_ate_compute_f_ell_P
bls12_377_ate_compute_f_ell_P(protoboard< FieldT > &pb, const pb_linear_combination< FieldT > &Px, const pb_linear_combination< FieldT > &Py, const bls12_377_ate_ell_coeffs< ppT > &ell_coeffs, const Fp12_2over3over2_variable< FqkT > &f, const Fp12_2over3over2_variable< FqkT > &f_out, const std::string &annotation_prefix)
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::_f_squared
std::vector< std::shared_ptr< Fp12_2over3over2_square_gadget< FqkT > > > _f_squared
Definition: bls12_377_miller_loop.hpp:127
libsnark::bls12_377_miller_loop_gadget::FieldT
libff::Fr< ppT > FieldT
Definition: bls12_377_miller_loop.hpp:59
libsnark::bls12_377_ate_compute_f_ell_P::_compute_ell_vw_times_Py
Fqe_mul_by_lc_gadget< ppT > _compute_ell_vw_times_Py
Definition: bls12_377_miller_loop.hpp:38
bw6_761_pairing_params.hpp
libsnark::gadget
Definition: gadget.hpp:16
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::bls12_377_e_over_e_miller_loop_gadget::bls12_377_e_over_e_miller_loop_gadget
bls12_377_e_over_e_miller_loop_gadget(protoboard< libff::Fr< ppT >> &pb, const bls12_377_G1_precomputation< ppT > &P1_prec, const bls12_377_G2_precomputation< ppT > &Q1_prec, const bls12_377_G1_precomputation< ppT > &P2_prec, const bls12_377_G2_precomputation< ppT > &Q2_prec, const Fp12_2over3over2_variable< FqkT > &result, const std::string &annotation_prefix)
libsnark::bls12_377_e_over_e_miller_loop_gadget::_f_ell_P
std::vector< std::shared_ptr< bls12_377_ate_compute_f_ell_P< ppT > > > _f_ell_P
Definition: bls12_377_miller_loop.hpp:100
libsnark::bls12_377_ate_compute_f_ell_P::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::bls12_377_miller_loop_gadget::result
const Fp12_2over3over2_variable< FqkT > & result() const
bls12_377_precomputation.hpp
libsnark::bls12_377_miller_loop_gadget::_f_squared
std::vector< std::shared_ptr< Fp12_2over3over2_square_gadget< FqkT > > > _f_squared
Definition: bls12_377_miller_loop.hpp:68
libsnark::bls12_377_miller_loop_gadget::FqeT
libff::Fqe< other_curve< ppT > > FqeT
Definition: bls12_377_miller_loop.hpp:60
fp12_2over3over2_gadgets.hpp
libsnark::bls12_377_miller_loop_gadget::bls12_377_miller_loop_gadget
bls12_377_miller_loop_gadget(protoboard< FieldT > &pb, const bls12_377_G1_precomputation< ppT > &prec_P, const bls12_377_G2_precomputation< ppT > &prec_Q, const Fqk_variable< ppT > &result, const std::string &annotation_prefix)
libsnark::bls12_377_ate_compute_f_ell_P::_compute_ell_vv_times_Px
Fqe_mul_by_lc_gadget< ppT > _compute_ell_vv_times_Px
Definition: bls12_377_miller_loop.hpp:37
libsnark::bls12_377_e_over_e_miller_loop_gadget::_f0
Fp12_2over3over2_variable< FqkT > _f0
Definition: bls12_377_miller_loop.hpp:92
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::_minus_P4_Y
pb_linear_combination< FieldT > _minus_P4_Y
Definition: bls12_377_miller_loop.hpp:123
libsnark::bls12_377_e_over_e_miller_loop_gadget::_f_squared
std::vector< std::shared_ptr< Fp12_2over3over2_square_gadget< FqkT > > > _f_squared
Definition: bls12_377_miller_loop.hpp:97
weierstrass_g2_gadget.hpp
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget
bls12_377_e_times_e_times_e_over_e_miller_loop_gadget(protoboard< libff::Fr< ppT >> &pb, const bls12_377_G1_precomputation< ppT > &P1_prec, const bls12_377_G2_precomputation< ppT > &Q1_prec, const bls12_377_G1_precomputation< ppT > &P2_prec, const bls12_377_G2_precomputation< ppT > &Q2_prec, const bls12_377_G1_precomputation< ppT > &P3_prec, const bls12_377_G2_precomputation< ppT > &Q3_prec, const bls12_377_G1_precomputation< ppT > &P4_prec, const bls12_377_G2_precomputation< ppT > &Q4_prec, const Fp12_2over3over2_variable< FqkT > &result, const std::string &annotation_prefix)
libsnark::pb_linear_combination
Definition: pb_variable.hpp:101
libsnark::Fqe_mul_by_lc_gadget
typename pairing_selector< ppT >::Fqe_mul_by_lc_gadget_type Fqe_mul_by_lc_gadget
Definition: pairing_params.hpp:102
libsnark::bls12_377_miller_loop_gadget::FqkT
libff::Fqk< other_curve< ppT > > FqkT
Definition: bls12_377_miller_loop.hpp:61
libsnark::bls12_377_e_over_e_miller_loop_gadget::_minus_P2_Y
pb_linear_combination< FieldT > _minus_P2_Y
Definition: bls12_377_miller_loop.hpp:93
libsnark::bls12_377_G2_precomputation
Definition: bls12_377_precomputation.hpp:79
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget::_f_ell_P
std::vector< std::shared_ptr< bls12_377_ate_compute_f_ell_P< ppT > > > _f_ell_P
Definition: bls12_377_miller_loop.hpp:130
libsnark::bls12_377_e_times_e_times_e_over_e_miller_loop_gadget
Definition: bls12_377_miller_loop.hpp:115
libsnark::Fqk_variable
typename pairing_selector< ppT >::Fqk_variable_type Fqk_variable
Definition: pairing_params.hpp:108
libsnark::bls12_377_miller_loop_gadget::_f_ell_P
std::vector< std::shared_ptr< bls12_377_ate_compute_f_ell_P< ppT > > > _f_ell_P
Definition: bls12_377_miller_loop.hpp:71
libsnark::bls12_377_ate_compute_f_ell_P::FqkT
libff::Fqk< other_curve< ppT > > FqkT
Definition: bls12_377_miller_loop.hpp:35
libsnark::Fp12_2over3over2_mul_by_024_gadget< FqkT >
bls12_377_miller_loop.tcc
libsnark::Fp12_2over3over2_variable< FqkT >
libsnark::bls12_377_miller_loop_gadget::Fq6T
typename FqkT::my_Fp6 Fq6T
Definition: bls12_377_miller_loop.hpp:62
weierstrass_g1_gadget.hpp
libsnark::bls12_377_ate_compute_f_ell_P::_compute_f_mul_ell_P
Fp12_2over3over2_mul_by_024_gadget< FqkT > _compute_f_mul_ell_P
Definition: bls12_377_miller_loop.hpp:39
libsnark::bls12_377_G1_precomputation
Definition: bls12_377_precomputation.hpp:15
libsnark::bls12_377_e_over_e_miller_loop_gadget::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::protoboard
Definition: pb_variable.hpp:22