nil::crypto3::zk::snark::transcript< CurveType, Hash > Class Template Reference

Transcript policy. Assumed to be inherited by particular algorithms. More...

#include <transcript.hpp>

+ Collaboration diagram for nil::crypto3::zk::snark::transcript< CurveType, Hash >:

Public Types

typedef nil::marshalling::curve_bincode< curve_typebincode
 
typedef CurveType curve_type
 
typedef Hash hash_type
 

Public Member Functions

template<typename TManifest::challenges_ids ChallengeId>
std::tuple_element< ChallengeId, typename TManifest::challenges > get_challenge () const
 For ordinary challenges. \alpha. More...
 
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
std::tuple_element< Index, std::tuple_element< ChallengeId, typename TManifest::challenges > > get_challenge () const
 For indexed challenges. (\alpha_0, ..., \alpha_n) More...
 
template<typename TManifest::challenges_ids ChallengeId>
std::tuple_element< ChallengeId, typename TManifest::processors >::result_type get_challenge_result ()
 For ordinary challenges. \alpha. More...
 
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
std::tuple_element< Index, std::tuple_element< ChallengeId, typename TManifest::processors > >::result_type get_challenge_result ()
 For indexed challenges. (\alpha_0, ..., \alpha_n) More...
 
curve_type::scalar_field_type::value_type read_challenge ()
 
template<typename TManifest::challenges_ids ChallengeId>
bool set_challenge (std::tuple_element< ChallengeId, typename TManifest::challenges > value)
 For ordinary challenges. \alpha. More...
 
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
bool set_challenge (std::tuple_element< Index, std::tuple_element< ChallengeId, typename TManifest::challenges >> value)
 For indexed challenges. (\alpha_0, ..., \alpha_n) More...
 
 transcript ()
 
template<typename InputIterator , typename std::enable_if< std::is_same< std::uint8_t, typename std::iterator_traits< InputIterator >::value_type >::value, bool >::type = true>
 transcript (InputIterator first, InputIterator last)
 
 transcript (std::tuple<> in_challenges)
 
template<typename FieldType >
std::enable_if< std::is_same< typename curve_type::base_field_type, FieldType >::value||std::is_same< typename curve_type::scalar_field_type, FieldType >::value||std::is_same< typename curve_type::gt_type, FieldType >::value >::type write (const typename FieldType::value_type &x)
 
template<typename GroupType >
std::enable_if< std::is_same< typename curve_type::template g1_type<>, GroupType >::value||std::is_same< typename curve_type::template g2_type<>, GroupType >::value >::type write (const typename GroupType::value_type &x)
 
template<typename InputIterator >
std::enable_if< std::is_same< std::uint8_t, typename std::iterator_traits< InputIterator >::value_type >::value >::type write (InputIterator first, InputIterator last)
 
template<typename InputIterator , typename std::enable_if< std::is_same< std::uint8_t, typename std::iterator_traits< InputIterator >::value_type >::value, bool >::type = true>
void write_domain_separator (InputIterator first, InputIterator last)
 

Public Attributes

std::vector< std::uint8_t > buffer
 
::nil::crypto3::accumulator_set< Hash > hasher_acc
 

Detailed Description

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
class nil::crypto3::zk::snark::transcript< CurveType, Hash >

Transcript policy. Assumed to be inherited by particular algorithms.

Template Parameters
TManifestTranscript Manifest in the following form:

class transcript_manifest {

std::size_t gammas_amount = 5;

public: enum challenges_ids{ alpha, beta, gamma = 10, delta = gamma + gammas_amount, epsilon }

typedef std::tuple<...> challenges; typedef std::tuple<...> processors; };

In the case above we have following list of challenges: (\alpha, \beta, \gamma_0, \gamma_1, \gamma_2, \gamma_3, \gamma_4, \delta, \varepsilon)

Member Typedef Documentation

◆ bincode

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
typedef nil::marshalling::curve_bincode<curve_type> nil::crypto3::zk::snark::transcript< CurveType, Hash >::bincode

◆ curve_type

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
typedef CurveType nil::crypto3::zk::snark::transcript< CurveType, Hash >::curve_type

◆ hash_type

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
typedef Hash nil::crypto3::zk::snark::transcript< CurveType, Hash >::hash_type

Constructor & Destructor Documentation

◆ transcript() [1/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename InputIterator , typename std::enable_if< std::is_same< std::uint8_t, typename std::iterator_traits< InputIterator >::value_type >::value, bool >::type = true>
nil::crypto3::zk::snark::transcript< CurveType, Hash >::transcript ( InputIterator  first,
InputIterator  last 
)
inline

◆ transcript() [2/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
nil::crypto3::zk::snark::transcript< CurveType, Hash >::transcript ( )
inline

◆ transcript() [3/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
nil::crypto3::zk::snark::transcript< CurveType, Hash >::transcript ( std::tuple<>  in_challenges)
inline

Member Function Documentation

◆ get_challenge() [1/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId>
std::tuple_element<ChallengeId, typename TManifest::challenges> nil::crypto3::zk::snark::transcript< CurveType, Hash >::get_challenge ( ) const
inline

For ordinary challenges. \alpha.

Template Parameters
ChallengeIdOrdinary challenge ID. In the example above it's \alpha.

◆ get_challenge() [2/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
std::tuple_element<Index, std::tuple_element<ChallengeId, typename TManifest::challenges> > nil::crypto3::zk::snark::transcript< CurveType, Hash >::get_challenge ( ) const
inline

For indexed challenges. (\alpha_0, ..., \alpha_n)

Template Parameters
ChallengeIdIndexed challenge ID. In the example above it's \alpha.
IndexIndex of the particular challenge. In the example above it's \alpha_i.

◆ get_challenge_result() [1/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId>
std::tuple_element<ChallengeId, typename TManifest::processors>::result_type nil::crypto3::zk::snark::transcript< CurveType, Hash >::get_challenge_result ( )
inline

For ordinary challenges. \alpha.

Template Parameters
ChallengeIdOrdinary challenge ID. In the example above it's \alpha.

◆ get_challenge_result() [2/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
std::tuple_element<Index, std::tuple_element<ChallengeId, typename TManifest::processors> >::result_type nil::crypto3::zk::snark::transcript< CurveType, Hash >::get_challenge_result ( )
inline

For indexed challenges. (\alpha_0, ..., \alpha_n)

Template Parameters
ChallengeIdIndexed challenge ID. In the example above it's \alpha.
IndexIndex of the particular challenge. In the example above it's \alpha_i.

◆ read_challenge()

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
curve_type::scalar_field_type::value_type nil::crypto3::zk::snark::transcript< CurveType, Hash >::read_challenge ( )
inline

◆ set_challenge() [1/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId>
bool nil::crypto3::zk::snark::transcript< CurveType, Hash >::set_challenge ( std::tuple_element< ChallengeId, typename TManifest::challenges >  value)
inline

For ordinary challenges. \alpha.

Template Parameters
ChallengeIdOrdinary challenge ID. In the example above it's \alpha.

◆ set_challenge() [2/2]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename TManifest::challenges_ids ChallengeId, std::size_t Index>
bool nil::crypto3::zk::snark::transcript< CurveType, Hash >::set_challenge ( std::tuple_element< Index, std::tuple_element< ChallengeId, typename TManifest::challenges >>  value)
inline

For indexed challenges. (\alpha_0, ..., \alpha_n)

Template Parameters
ChallengeIdIndexed challenge ID. In the example above it's \alpha.
IndexIndex of the particular challenge. In the example above it's \alpha_i.

◆ write() [1/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename FieldType >
std::enable_if< std::is_same<typename curve_type::base_field_type, FieldType>::value || std::is_same<typename curve_type::scalar_field_type, FieldType>::value || std::is_same<typename curve_type::gt_type, FieldType>::value>::type nil::crypto3::zk::snark::transcript< CurveType, Hash >::write ( const typename FieldType::value_type &  x)
inline

◆ write() [2/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename GroupType >
std::enable_if< std::is_same<typename curve_type::template g1_type<>, GroupType>::value || std::is_same<typename curve_type::template g2_type<>, GroupType>::value>::type nil::crypto3::zk::snark::transcript< CurveType, Hash >::write ( const typename GroupType::value_type &  x)
inline

◆ write() [3/3]

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename InputIterator >
std::enable_if< std::is_same<std::uint8_t, typename std::iterator_traits<InputIterator>::value_type>::value>::type nil::crypto3::zk::snark::transcript< CurveType, Hash >::write ( InputIterator  first,
InputIterator  last 
)
inline

◆ write_domain_separator()

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
template<typename InputIterator , typename std::enable_if< std::is_same< std::uint8_t, typename std::iterator_traits< InputIterator >::value_type >::value, bool >::type = true>
void nil::crypto3::zk::snark::transcript< CurveType, Hash >::write_domain_separator ( InputIterator  first,
InputIterator  last 
)
inline

Member Data Documentation

◆ buffer

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
std::vector<std::uint8_t> nil::crypto3::zk::snark::transcript< CurveType, Hash >::buffer

◆ hasher_acc

template<typename CurveType = algebra::curves::bls12<381>, typename Hash = hashes::sha2<256>>
::nil::crypto3::accumulator_set<Hash> nil::crypto3::zk::snark::transcript< CurveType, Hash >::hasher_acc

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