package merkle

import "github.com/google/trillian/merkle"

Package merkle provides Merkle tree manipulation functions.

Deprecated: This package is superseded by the corresponding functionality in https://github.com/transparency-dev/merkle. It will be removed in future releases of Trillian.

Index

Functions

func Rehash

func Rehash(h [][]byte, nf []NodeFetch, hc func(left, right []byte) []byte) ([][]byte, error)

Rehash computes the proof based on the slice of NodeFetch structs, and the corresponding hashes of these nodes. The slices must be of the same length. The hc parameter computes node's hash based on hashes of its children.

Warning: The passed-in slice of hashes can be modified in-place.

Types

type NodeFetch

type NodeFetch struct {
	ID     compact.NodeID
	Rehash bool
}

NodeFetch bundles a node ID with additional information on how to use the node to construct a proof.

func CalcConsistencyProofNodeAddresses

func CalcConsistencyProofNodeAddresses(size1, size2 int64) ([]NodeFetch, error)

CalcConsistencyProofNodeAddresses returns the tree node IDs needed to build a consistency proof between two specified tree sizes. All the returned nodes represent complete subtrees in the tree of size2 or above.

Use Rehash function to compose the proof after the node hashes are fetched.

func CalcInclusionProofNodeAddresses

func CalcInclusionProofNodeAddresses(size, index int64) ([]NodeFetch, error)

CalcInclusionProofNodeAddresses returns the tree node IDs needed to build an inclusion proof for a specified tree size and leaf index. All the returned nodes represent complete subtrees in the tree of this size or above.

Use Rehash function to compose the proof after the node hashes are fetched.

Source Files

doc.go log_proofs.go

Directories

PathSynopsis
merkle/compactPackage compact provides compact Merkle tree data structures.
merkle/coniksPackage coniks provides CONIKS hashing for maps.
merkle/hashersPackage hashers provides an interface for log hashers.
merkle/logverifierPackage logverifier implements proof verificaion helpers for Merkle trees.
merkle/rfc6962Package rfc6962 provides hashing functionality according to RFC6962.
merkle/smtPackage smt contains the implementation of the sparse Merkle tree logic.
merkle/smt/nodePackage node implements a sparse Merkle tree node.
merkle/testonlyPackage testonly contains code and data for testing Merkle trees.
Version
v1.4.2
Published
Jul 25, 2022
Platform
js/wasm
Imports
5 packages
Last checked
4 hours ago

Tools for package owners.