Documentation ¶
Overview ¶
mimc wraps the github.com/consensys/gnark-crypto/ecc/bls12-377/fr/mimc and provides low-level utility methods to use the block compression of MiMC directly. This is used in several occasions in the wizard package to implement and test the arithmetization of the MiMC block compression function and to have interfaces that are friendly to field elements.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Constants []field.Element = func() []field.Element { bigConsts := mimc.GetConstants() res := make([]field.Element, len(bigConsts)) for i := range res { res[i].SetBigInt(&bigConsts[i]) } return res }()
Constants collects the MiMC constants parsed as field elements
Functions ¶
func BlockCompression ¶
BlockCompression applies the MiMC block compression function to a given block over a given state. This what is run under the hood by the MiMC hash function in Miyaguchi-Preneel mode.
func GnarkBlockCompression ¶
func GnarkBlockCompression(api frontend.API, oldState, block frontend.Variable) (newState frontend.Variable)
GnarkBlockCompression applies the MiMC permutation to a given block within a gnark circuit and mirrors exactly BlockCompression.
func NewMiMC ¶
NewMiMC wraps mimc.NewMiMC, this is used to limit the number of gnark-crypto imports.
Types ¶
This section is empty.