nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType > Class Template Reference

#include <sha256_component.hpp>

+ Inheritance diagram for nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >:
+ Collaboration diagram for nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >:

Public Types

typedef std::vector< bool > hash_value_type
 
typedef digest_variable< FieldType > hash_variable_type
 
typedef snark::merkle_authentication_path merkle_authentication_path_type
 

Public Member Functions

void generate_r1cs_constraints (bool ensure_output_bitness=true)
 
void generate_r1cs_witness ()
 
 sha256_two_to_one_hash_component (blueprint< FieldType > &bp, const digest_variable< FieldType > &left, const digest_variable< FieldType > &right, const digest_variable< FieldType > &output)
 
 sha256_two_to_one_hash_component (blueprint< FieldType > &bp, std::size_t block_length, const block_variable< FieldType > &input_block, const digest_variable< FieldType > &output)
 

Static Public Member Functions

static std::size_t expected_constraints (bool ensure_output_bitness=true)
 
static std::size_t get_block_len ()
 
static std::size_t get_digest_len ()
 
static std::vector< bool > get_hash (const std::vector< bool > &input)
 

Public Attributes

std::shared_ptr< sha256_compression_function_component< FieldType > > f
 

Protected Attributes

blueprint< FieldType > & bp
 

Detailed Description

template<typename FieldType>
class nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >

Component 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_component trivially extends to a collision for full SHA256 (by appending the same padding).

Member Typedef Documentation

◆ hash_value_type

template<typename FieldType >
typedef std::vector<bool> nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::hash_value_type

◆ hash_variable_type

template<typename FieldType >
typedef digest_variable<FieldType> nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::hash_variable_type

◆ merkle_authentication_path_type

Constructor & Destructor Documentation

◆ sha256_two_to_one_hash_component() [1/2]

template<typename FieldType >
nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::sha256_two_to_one_hash_component ( blueprint< FieldType > &  bp,
const digest_variable< FieldType > &  left,
const digest_variable< FieldType > &  right,
const digest_variable< FieldType > &  output 
)
inline

◆ sha256_two_to_one_hash_component() [2/2]

template<typename FieldType >
nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::sha256_two_to_one_hash_component ( blueprint< FieldType > &  bp,
std::size_t  block_length,
const block_variable< FieldType > &  input_block,
const digest_variable< FieldType > &  output 
)
inline

Member Function Documentation

◆ expected_constraints()

template<typename FieldType >
static std::size_t nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::expected_constraints ( bool  ensure_output_bitness = true)
inlinestatic

◆ generate_r1cs_constraints()

template<typename FieldType >
void nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::generate_r1cs_constraints ( bool  ensure_output_bitness = true)
inline

◆ generate_r1cs_witness()

template<typename FieldType >
void nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::generate_r1cs_witness ( )
inline

◆ get_block_len()

template<typename FieldType >
static std::size_t nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::get_block_len ( )
inlinestatic

◆ get_digest_len()

template<typename FieldType >
static std::size_t nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::get_digest_len ( )
inlinestatic

◆ get_hash()

template<typename FieldType >
static std::vector<bool> nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::get_hash ( const std::vector< bool > &  input)
inlinestatic

Member Data Documentation

◆ bp

template<typename FieldType >
blueprint<FieldType>& nil::crypto3::zk::components::component< FieldType >::bp
protectedinherited

◆ f

template<typename FieldType >
std::shared_ptr<sha256_compression_function_component<FieldType> > nil::crypto3::zk::components::sha256_two_to_one_hash_component< FieldType >::f

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