Clearmatics Libsnark
0.1
C++ library for zkSNARK proofs
|
#include <scalar_multiplication.hpp>
Public Types | |
using | FieldT = libff::Fr< ppT > |
Public Member Functions | |
variable_or_identity (protoboard< FieldT > &pb, const std::string &annotation_prefix) | |
variable_or_identity (protoboard< FieldT > &pb, const groupT &P, const std::string &annotation_prefix) | |
void | generate_r1cs_constraints () |
void | generate_r1cs_witness (const groupT &elt) |
void | generate_r1cs_witness (bool is_identity) |
groupT | get_element () const |
![]() | |
gadget (protoboard< libff::Fr< ppT > > &pb, const std::string &annotation_prefix) | |
Public Attributes | |
groupVariableT | value |
pb_linear_combination< FieldT > | is_identity |
Protected Attributes | |
pb_variable< FieldT > | is_identity_var |
![]() | |
protoboard< libff::Fr< ppT > > & | pb |
const std::string | annotation_prefix |
Wrapper for group variable, adding a flag that indicates whether the variable is the identity.
For use in 2 possible configurations:
1) Construct with variable_or_identity(pb, annotation_prefix), which internally allocates variables for the group element and flag. Values can later be set via generate_r1cs_witness() calls.
2) Construct using a group element value, which defines values as linear combinations (no variable allocation). generate_r1cs_witness() calls should NOT be made to such objects.
Definition at line 35 of file scalar_multiplication.hpp.
using libsnark::variable_or_identity< ppT, groupT, groupVariableT >::FieldT = libff::Fr<ppT> |
Definition at line 38 of file scalar_multiplication.hpp.
libsnark::variable_or_identity< ppT, groupT, groupVariableT >::variable_or_identity | ( | protoboard< FieldT > & | pb, |
const std::string & | annotation_prefix | ||
) |
libsnark::variable_or_identity< ppT, groupT, groupVariableT >::variable_or_identity | ( | protoboard< FieldT > & | pb, |
const groupT & | P, | ||
const std::string & | annotation_prefix | ||
) |
void libsnark::variable_or_identity< ppT, groupT, groupVariableT >::generate_r1cs_constraints | ( | ) |
Constrains the is_identity
flag to be boolean. Do not call this if the setter can guarantee boolean-ness in some other way.
void libsnark::variable_or_identity< ppT, groupT, groupVariableT >::generate_r1cs_witness | ( | bool | is_identity | ) |
For the case where value
has been set by other gadgets, and we simply wish to set whether this variable should be considered the identity.
void libsnark::variable_or_identity< ppT, groupT, groupVariableT >::generate_r1cs_witness | ( | const groupT & | elt | ) |
If elt == 0, this sets value
to 1 and is_identity
to true, otherwise it sets value
to elt
and is_identity
to false.
groupT libsnark::variable_or_identity< ppT, groupT, groupVariableT >::get_element | ( | ) | const |
pb_linear_combination<FieldT> libsnark::variable_or_identity< ppT, groupT, groupVariableT >::is_identity |
Definition at line 41 of file scalar_multiplication.hpp.
|
protected |
Definition at line 72 of file scalar_multiplication.hpp.
groupVariableT libsnark::variable_or_identity< ppT, groupT, groupVariableT >::value |
Definition at line 40 of file scalar_multiplication.hpp.