Clearmatics Libsnark
0.1
C++ library for zkSNARK proofs
|
Go to the documentation of this file.
15 #ifndef LIBSNARK_GADGETLIB1_GADGETS_PAIRING_MNT_MNT_PRECOMPUTATION_HPP_
16 #define LIBSNARK_GADGETLIB1_GADGETS_PAIRING_MNT_MNT_PRECOMPUTATION_HPP_
22 #include <libff/algebra/curves/mnt/mnt4/mnt4_init.hpp>
23 #include <libff/algebra/curves/mnt/mnt6/mnt6_init.hpp>
30 template<
typename ppT>
class mnt_pairing_params;
41 typedef libff::Fqe<other_curve<ppT>>
FqeT;
42 typedef libff::Fqk<other_curve<ppT>>
FqkT;
44 std::shared_ptr<G1_variable<ppT>>
P;
51 const std::string &annotation_prefix);
57 template<
typename ppT>
61 typedef libff::Fqe<other_curve<ppT>>
FqeT;
62 typedef libff::Fqk<other_curve<ppT>>
FqkT;
67 template<
typename FieldT>
73 const typename std::enable_if<
75 FieldT>::type & = FieldT())
79 c0.
assign(
pb, P.
Y * ((libff::mnt4_twist).squared().coeffs[0]));
80 c1.
assign(
pb, P.
Y * ((libff::mnt4_twist).squared().coeffs[1]));
87 template<
typename FieldT>
93 const typename std::enable_if<
95 FieldT>::type & = FieldT())
99 c0.
assign(
pb, P.
Y * ((libff::mnt6_twist).squared().coeffs[0]));
100 c1.
assign(
pb, P.
Y * ((libff::mnt6_twist).squared().coeffs[1]));
101 c2.
assign(
pb, P.
Y * ((libff::mnt6_twist).squared().coeffs[2]));
121 typedef libff::Fqe<other_curve<ppT>>
FqeT;
122 typedef libff::Fqk<other_curve<ppT>>
FqkT;
124 std::shared_ptr<Fqe_variable<ppT>>
RX;
125 std::shared_ptr<Fqe_variable<ppT>>
RY;
126 std::shared_ptr<Fqe_variable<ppT>>
gamma;
135 const std::string &annotation_prefix);
145 typedef libff::Fqe<other_curve<ppT>>
FqeT;
146 typedef libff::Fqk<other_curve<ppT>>
FqkT;
148 std::shared_ptr<G2_variable<ppT>>
Q;
150 std::vector<std::shared_ptr<mnt_precompute_G2_gadget_coeffs<ppT>>>
coeffs;
156 const std::string &annotation_prefix);
178 template<
typename ppT>
183 typedef libff::Fqe<other_curve<ppT>>
FqeT;
184 typedef libff::Fqk<other_curve<ppT>>
FqkT;
192 std::shared_ptr<Fqe_variable<ppT>>
two_RY;
229 template<
typename ppT>
234 typedef libff::Fqe<other_curve<ppT>>
FqeT;
235 typedef libff::Fqk<other_curve<ppT>>
FqkT;
268 template<
typename ppT>
273 typedef libff::Fqe<other_curve<ppT>>
FqeT;
274 typedef libff::Fqk<other_curve<ppT>>
FqkT;
276 std::vector<std::shared_ptr<mnt_precompute_G2_gadget_addition_step<ppT>>>
278 std::vector<std::shared_ptr<mnt_precompute_G2_gadget_doubling_step<ppT>>>
299 #endif // LIBSNARK_GADGETLIB1_GADGETS_PAIRING_MNT_MNT_PRECOMPUTATION_HPP_
libff::Fqk< other_curve< ppT > > FqkT
void generate_r1cs_constraints()
const std::string annotation_prefix
std::shared_ptr< Fqe_variable< ppT > > RY_minus_QY
std::shared_ptr< Fqe_variable< ppT > > RXsquared
Gadget that represents a G2 variable.
pb_linear_combination< FieldT > Y
mnt_precompute_G2_gadget_coeffs< ppT > next
std::shared_ptr< Fqe_variable< ppT > > RY_plus_next_RY
libff::Fqk< other_curve< ppT > > FqkT
mnt_precompute_G2_gadget_addition_step(protoboard< FieldT > &pb, const bool invert_Q, const mnt_precompute_G2_gadget_coeffs< ppT > &cur, const mnt_precompute_G2_gadget_coeffs< ppT > &next, const G2_variable< ppT > &Q, const std::string &annotation_prefix)
std::shared_ptr< Fqe_variable< ppT > > RX
mnt_precompute_G2_gadget_coeffs< ppT > cur
std::shared_ptr< Fqe_sqr_gadget< ppT > > compute_RXsquared
protoboard< libff::Fr< ppT > > & pb
mnt_G2_precomputation< ppT > & precomp
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_next_RY
std::shared_ptr< Fqe_sqr_gadget< ppT > > compute_next_RX
std::shared_ptr< Fqe_variable< ppT > > gamma
std::shared_ptr< Fqe_sqr_gadget< ppT > > compute_next_RX
void generate_r1cs_witness()
std::shared_ptr< Fqe_variable< ppT > > three_RXsquared_plus_a
libff::Fqe< other_curve< ppT > > FqeT
mnt_precompute_G2_gadget_coeffs()
std::shared_ptr< Fqe_variable< ppT > > next_RX_plus_RX_plus_QX
void generate_r1cs_witness()
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_gamma_X
std::shared_ptr< Fqe_variable< ppT > > RX_minus_next_RX
std::shared_ptr< Fqe_variable< ppT > > two_RY
std::shared_ptr< Fqe_variable< ppT > > gamma_X
std::shared_ptr< G1_variable< ppT > > P
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_gamma_X
std::shared_ptr< Fqe_variable< ppT > > RY_plus_next_RY
mnt_G1_precomputation< ppT > & precomp
mnt_precompute_G1_gadget(protoboard< FieldT > &pb, const G1_variable< ppT > &P, mnt_G1_precomputation< ppT > &precomp, const std::string &annotation_prefix, const typename std::enable_if< libff::Fqk< other_curve< ppT >>::extension_degree()==4, FieldT >::type &=FieldT())
std::vector< std::shared_ptr< mnt_precompute_G2_gadget_coeffs< ppT > > > coeffs
void generate_r1cs_constraints()
libff::Fqe< other_curve< ppT > > FqeT
mnt_precompute_G2_gadget_doubling_step(protoboard< FieldT > &pb, const mnt_precompute_G2_gadget_coeffs< ppT > &cur, const mnt_precompute_G2_gadget_coeffs< ppT > &next, const std::string &annotation_prefix)
libff::Fqe< other_curve< ppT > > FqeT
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_next_RY
libff::Fqk< other_curve< ppT > > FqkT
std::shared_ptr< Fqe_variable< ppT > > RY
std::shared_ptr< Fqe_variable< ppT > > next_RX_plus_two_RX
Gadget that represents a G1 variable.
std::shared_ptr< Fqe_variable< ppT > > RX_minus_QX
typename pairing_selector< ppT >::Fqe_variable_type Fqe_variable
libff::Fqk< other_curve< ppT > > FqkT
mnt_precompute_G2_gadget(protoboard< FieldT > &pb, const G2_variable< ppT > &Q, mnt_G2_precomputation< ppT > &precomp, const std::string &annotation_prefix)
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_gamma
typename pairing_selector< ppT >::other_curve_type other_curve
std::vector< std::shared_ptr< mnt_precompute_G2_gadget_addition_step< ppT > > > addition_steps
void assign(protoboard< FieldT > &pb, const linear_combination< FieldT > &lc)
mnt_precompute_G2_gadget_coeffs< ppT > next
libff::Fqk< other_curve< ppT > > FqkT
std::shared_ptr< Fqe_mul_gadget< ppT > > compute_gamma
libff::Fqe< other_curve< ppT > > FqeT
std::shared_ptr< Fqe_variable< ppT > > PY_twist_squared
mnt_precompute_G2_gadget_coeffs< ppT > cur
libff::Fqk< other_curve< ppT > > FqkT
void generate_r1cs_constraints()
libff::Fqe< other_curve< ppT > > FqeT
std::shared_ptr< Fqe_variable< ppT > > RX_minus_next_RX
std::shared_ptr< G2_variable< ppT > > Q
libff::Fqe< other_curve< ppT > > FqeT
std::vector< std::shared_ptr< mnt_precompute_G2_gadget_doubling_step< ppT > > > doubling_steps
libff::Fqe< other_curve< ppT > > FqeT
void generate_r1cs_witness()
void generate_r1cs_constraints()
mnt_precompute_G1_gadget(protoboard< FieldT > &pb, const G1_variable< ppT > &P, mnt_G1_precomputation< ppT > &precomp, const std::string &annotation_prefix, const typename std::enable_if< libff::Fqk< other_curve< ppT >>::extension_degree()==6, FieldT >::type &=FieldT())
libff::Fqk< other_curve< ppT > > FqkT
void generate_r1cs_witness()