Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | Static Public Member Functions | List of all members
libzeth::MiMC_mp_gadget< FieldT, PermutationT > Class Template Reference

#include <mimc_mp.hpp>

Public Member Functions

 MiMC_mp_gadget (libsnark::protoboard< FieldT > &pb, const libsnark::pb_linear_combination< FieldT > &x, const libsnark::pb_linear_combination< FieldT > &y, const libsnark::pb_variable< FieldT > &result, const std::string &annotation_prefix="MiMC_mp_gadget")
 
void generate_r1cs_constraints ()
 
void generate_r1cs_witness () const
 

Static Public Member Functions

static FieldT get_hash (const FieldT x, FieldT y)
 

Detailed Description

template<typename FieldT, typename PermutationT>
class libzeth::MiMC_mp_gadget< FieldT, PermutationT >

This gadget implements the interface of the HashTreeT template.

MiMC_mp_gadget enforces correct computation of the MiMC compression function, based on a the Miyaguchi-Preneel compression construct using a MiMC_permutation_gadget instance, PermutationT, operating on FieldT elements.

This class contains only an instance of PermutationT, with parameters configured to make it efficiently compute Miyaguchi-Preneel. As such, it may appear as first sight that it should inherit from PermutationT. We do not inherit from PermutationT, either publicly (because the "is-a" relationship does not hold in general), or privately (because the pb_linear_combination interface does not support immediate construction of x + y, making the constructor very awkard - this is also the reason that a pointer is required, rather than a simple instance of PermutationT). Further, we do not inherit from libsnark::gadget<>, as it is not necessary and would just add unused data to the class.

Definition at line 30 of file mimc_mp.hpp.

Constructor & Destructor Documentation

◆ MiMC_mp_gadget()

template<typename FieldT , typename PermutationT >
libzeth::MiMC_mp_gadget< FieldT, PermutationT >::MiMC_mp_gadget ( libsnark::protoboard< FieldT > &  pb,
const libsnark::pb_linear_combination< FieldT > &  x,
const libsnark::pb_linear_combination< FieldT > &  y,
const libsnark::pb_variable< FieldT > &  result,
const std::string &  annotation_prefix = "MiMC_mp_gadget< FieldT, PermutationT >" 
)

Member Function Documentation

◆ generate_r1cs_constraints()

template<typename FieldT , typename PermutationT >
void libzeth::MiMC_mp_gadget< FieldT, PermutationT >::generate_r1cs_constraints ( )

◆ generate_r1cs_witness()

template<typename FieldT , typename PermutationT >
void libzeth::MiMC_mp_gadget< FieldT, PermutationT >::generate_r1cs_witness ( ) const

◆ get_hash()

template<typename FieldT , typename PermutationT >
static FieldT libzeth::MiMC_mp_gadget< FieldT, PermutationT >::get_hash ( const FieldT  x,
FieldT  y 
)
static

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