Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
libsnark::sha256_two_to_one_hash_gadget< FieldT > Class Template Reference

#include <sha256_gadget.hpp>

Inheritance diagram for libsnark::sha256_two_to_one_hash_gadget< FieldT >:
Inheritance graph
[legend]
Collaboration diagram for libsnark::sha256_two_to_one_hash_gadget< FieldT >:
Collaboration graph
[legend]

Public Types

typedef libff::bit_vector hash_value_type
 
typedef merkle_authentication_path merkle_authentication_path_type
 

Public Member Functions

 sha256_two_to_one_hash_gadget (protoboard< FieldT > &pb, const digest_variable< FieldT > &left, const digest_variable< FieldT > &right, const digest_variable< FieldT > &output, const std::string &annotation_prefix)
 
 sha256_two_to_one_hash_gadget (protoboard< FieldT > &pb, const size_t block_length, const block_variable< FieldT > &input_block, const digest_variable< FieldT > &output, const std::string &annotation_prefix)
 
void generate_r1cs_constraints (const bool ensure_output_bitness=true)
 
void generate_r1cs_witness ()
 
- Public Member Functions inherited from libsnark::gadget< FieldT >
 gadget (protoboard< FieldT > &pb, const std::string &annotation_prefix)
 

Static Public Member Functions

static size_t get_block_len ()
 
static size_t get_digest_len ()
 
static libff::bit_vector get_hash (const libff::bit_vector &input)
 
static size_t expected_constraints (const bool ensure_output_bitness=true)
 

Public Attributes

std::shared_ptr< sha256_compression_function_gadget< FieldT > > f
 

Additional Inherited Members

- Protected Attributes inherited from libsnark::gadget< FieldT >
protoboard< FieldT > & pb
 
const std::string annotation_prefix
 

Detailed Description

template<typename FieldT>
class libsnark::sha256_two_to_one_hash_gadget< FieldT >

Gadget for the SHA256 compression function, viewed as a 2-to-1 hash function, and using the same initialization vector as in SHA256 specification. Thus, any collision for sha256_two_to_one_hash_gadget trivially extends to a collision for full SHA256 (by appending the same padding).

Definition at line 70 of file sha256_gadget.hpp.

Member Typedef Documentation

◆ hash_value_type

template<typename FieldT >
typedef libff::bit_vector libsnark::sha256_two_to_one_hash_gadget< FieldT >::hash_value_type

Definition at line 73 of file sha256_gadget.hpp.

◆ merkle_authentication_path_type

Definition at line 74 of file sha256_gadget.hpp.

Constructor & Destructor Documentation

◆ sha256_two_to_one_hash_gadget() [1/2]

template<typename FieldT >
libsnark::sha256_two_to_one_hash_gadget< FieldT >::sha256_two_to_one_hash_gadget ( protoboard< FieldT > &  pb,
const digest_variable< FieldT > &  left,
const digest_variable< FieldT > &  right,
const digest_variable< FieldT > &  output,
const std::string &  annotation_prefix 
)

◆ sha256_two_to_one_hash_gadget() [2/2]

template<typename FieldT >
libsnark::sha256_two_to_one_hash_gadget< FieldT >::sha256_two_to_one_hash_gadget ( protoboard< FieldT > &  pb,
const size_t  block_length,
const block_variable< FieldT > &  input_block,
const digest_variable< FieldT > &  output,
const std::string &  annotation_prefix 
)

Member Function Documentation

◆ expected_constraints()

template<typename FieldT >
static size_t libsnark::sha256_two_to_one_hash_gadget< FieldT >::expected_constraints ( const bool  ensure_output_bitness = true)
static

◆ generate_r1cs_constraints()

template<typename FieldT >
void libsnark::sha256_two_to_one_hash_gadget< FieldT >::generate_r1cs_constraints ( const bool  ensure_output_bitness = true)

◆ generate_r1cs_witness()

template<typename FieldT >
void libsnark::sha256_two_to_one_hash_gadget< FieldT >::generate_r1cs_witness ( )

◆ get_block_len()

template<typename FieldT >
static size_t libsnark::sha256_two_to_one_hash_gadget< FieldT >::get_block_len ( )
static

◆ get_digest_len()

template<typename FieldT >
static size_t libsnark::sha256_two_to_one_hash_gadget< FieldT >::get_digest_len ( )
static

◆ get_hash()

template<typename FieldT >
static libff::bit_vector libsnark::sha256_two_to_one_hash_gadget< FieldT >::get_hash ( const libff::bit_vector &  input)
static

Member Data Documentation

◆ f

template<typename FieldT >
std::shared_ptr<sha256_compression_function_gadget<FieldT> > libsnark::sha256_two_to_one_hash_gadget< FieldT >::f

Definition at line 76 of file sha256_gadget.hpp.


The documentation for this class was generated from the following file: