Versions in this module Expand all Collapse all v1 v1.2.1 Feb 7, 2024 Changes in this version + func MIMC7(left Element, right Element) []byte type Element + func (e Element) BigInt() *big.Int + func (e Element) Cmp(x Element) bool type SerializedTreeState + GetLevels func() int + GetRoot func() Element v1.2.0 Nov 15, 2023 Changes in this version type BaseTree + func (bt *BaseTree) VerifyProof(elem Element, proof ProofPath) error v1.1.0 Nov 15, 2023 Changes in this version + func Poseidon(left Element, right Element) []byte + func Poseidon2(left Element, right Element) []byte + func SHA256Hash(left Element, right Element) []byte v1.0.0 Nov 15, 2023 Changes in this version + func GobDecode(data []byte, e any) error + func GobEncode(e any) ([]byte, error) + func IndexOfElement(elements []Element, element Element, fromIndex int, ...) int + type BaseTree struct + func (bt *BaseTree) BulkInsert(elements []Element) error + func (bt *BaseTree) Insert(element Element) error + func (bt *BaseTree) Path(index int) (ProofPath, error) + func (bt *BaseTree) SetLayer(i, j int, val Element) + func (bt *BaseTree) Update(index int, element Element) error + func (bt BaseTree) Capacity() int + func (bt BaseTree) Elements() []Element + func (bt BaseTree) Layers() [][]Element + func (bt BaseTree) Root() Element + func (bt BaseTree) Zeros() []Element + type ComparatorFunction func(left Element, right Element) bool + type Element []byte + func (e Element) Hex() string + type HashFunction func(left Element, right Element) []byte + type MerkleTree struct + func DeserializeMerkleTree(data SerializedTreeState, hashFn HashFunction) (*MerkleTree, error) + func NewMerkleTree(levels int, elements []Element, zeroElement Element, hashFn HashFunction) (*MerkleTree, error) + func (mt *MerkleTree) BulkInsert(elements []Element) error + func (mt MerkleTree) GetTreeSlices(count int) ([]TreeSlice, error) + func (mt MerkleTree) IndexOf(element Element) int + func (mt MerkleTree) Proof(element Element) (ProofPath, error) + func (mt MerkleTree) Serialize() (SerializedTreeState, error) + type ProofPath struct + PathElements []Element + PathIndices []int + PathPositions []int + PathRoot Element + type SerializedTreeState struct + ID int + Layers []byte + Levels int + Zeros []byte + func NewSerializedTreeState(tree *MerkleTree) (SerializedTreeState, error) + func (st SerializedTreeState) GetLayers() ([][]Element, error) + func (st SerializedTreeState) GetZeros() ([]Element, error) + type TreeEdge struct + EdgeElement Element + EdgeElementsCount int + EdgeIndex int + EdgePath ProofPath + type TreeSlice struct + Edge TreeEdge + Elements []Element