merkle

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0, MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const DigestLength = 32

DigestLength is the length of a Digest in number of bytes.

Variables

This section is empty.

Functions

func VerifyProof

func VerifyProof(root Digest, index int, value []byte, proof []Digest) (valid bool, more bool)

VerifyProof verifies that the given value maps to the given index in the merkle-tree with the given root. It returns "more" if the value is not the last value in the merkle-tree.

Types

type Digest

type Digest = [DigestLength]byte

Digest is a 32-byte hash digest.

var ZeroDigest Digest

func Tree

func Tree(values [][]byte) Digest

Tree returns a the root of the merkle-tree of the given values.

func TreeWithProofs

func TreeWithProofs(values [][]byte) (Digest, [][]Digest)

TreeWithProofs returns a the root of the merkle-tree of the given values, along with merkle-proofs for each leaf.

Jump to

Keyboard shortcuts

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