emulated

package
v0.0.0-...-6972718 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MiMC

type MiMC[T emulated.FieldParams] struct {
	// contains filtered or unexported fields
}

MiMC contains the params of the Mimc hash func and the curves on which it is implemented

func NewMiMC

func NewMiMC[T emulated.FieldParams](field *emulated.Field[T]) (MiMC[T], error)

NewMiMC returns a MiMC instance, that can be used in a gnark circuit

func (*MiMC[T]) Reset

func (h *MiMC[T]) Reset()

Reset resets the Hash to its initial state.

func (*MiMC[T]) Sum

func (h *MiMC[T]) Sum() *emulated.Element[T]

Sum hash (in r1cs form) using Miyaguchi–Preneel: https://en.wikipedia.org/wiki/One-way_compression_function The XOR operation is replaced by field addition. See github.com/consensys/gnark-crypto for reference implementation.

func (*MiMC[T]) Write

func (h *MiMC[T]) Write(data ...*emulated.Element[T])

Write adds more data to the running hash.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL