Versions in this module Expand all Collapse all v0 v0.2.3 Mar 4, 2024 Changes in this version + var ErrDataBlockIsNil = errors.New("data block is nil") + var ErrInvalidConfigMode = errors.New("invalid configuration mode") + var ErrInvalidNumOfDataBlocks = errors.New("the number of data blocks must be greater than 1") + var ErrProofInvalidDataBlock = errors.New("data block is not a member of the merkle tree") + var ErrProofInvalidModeTreeNotBuilt = errors.New("merkle tree is not in built, could not generate proof by this method") + var ErrProofIsNil = errors.New("proof is nil") + func DefaultHashFunc(data []byte) ([]byte, error) + func DefaultHashFuncParallel(data []byte) ([]byte, error) + func Verify(dataBlock DataBlock, proof *Proof, root []byte, config *Config) (bool, error) + type Config struct + DisableLeafHashing bool + HashFunc TypeHashFunc + Mode TypeConfigMode + NumRoutines int + RunInParallel bool + SortSiblingPairs bool + type DataBlock interface + Serialize func() ([]byte, error) + type MerkleTree struct + Depth int + Leaves [][]byte + NumLeaves int + Proofs []*Proof + Root []byte + func New(config *Config, blocks []DataBlock) (m *MerkleTree, err error) + func (m *MerkleTree) Proof(dataBlock DataBlock) (*Proof, error) + func (m *MerkleTree) Verify(dataBlock DataBlock, proof *Proof) (bool, error) + type Proof struct + Path uint32 + Siblings [][]byte + type TypeConfigMode int + const ModeProofGen + const ModeProofGenAndTreeBuild + const ModeTreeBuild + type TypeHashFunc func([]byte) ([]byte, error)