Documentation
¶
Overview ¶
package hashtree implements a binary Merkle tree.
Merkle trees provide a simple way to verify the integrity of a large amount of data by way of "Merkle proofs" - a sequence of carefully selected hashes, one for each level of the tree.
Merkle trees can be n-ary trees, but here we implement binary Merkle trees, since they give the smallest sized proofs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Proof ¶
Proof represents a merkle proof, which is a sequence of sister hashes of a leaf node from the bottom to the root, that proves that a particular piece of data belongs to the tree. It also contains the index of the leaf in the bottom level of the tree to aid in verifying the proof.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree represents a merkle tree.
func (*Tree) ProofFor ¶
ProofFor returns the merkle proof for the leaf node at index i, or an error if that index does not exist.