webtessera/merkle/compact
Provides compact Merkle tree data structures.
It ports the Go package transparency-dev/merkle/compact.
Its source is src/vendor/merkle/compact/index.ts.
Functions
decompose- decompose splits the [begin, end) range into a minimal number of sub-ranges, each of which is of the form [m * 2^k, (m+1) * 2^k), i.e. of length 2^k, for some integers m, k >= 0.
newNodeID- newNodeID returns a NodeID with the passed in node coordinates.
rangeNodes- rangeNodes appends the IDs of the nodes that comprise the [begin, end) compact range to the given slice, and returns the new slice.
rangeSize- rangeSize returns the number of nodes in the [begin, end) compact range.
Classes
NodeID- NodeID identifies a node of a Merkle tree.
Range- Range represents a compact Merkle tree range for leaf indices [begin, end).
RangeFactory- RangeFactory allows creating compact ranges with the specified hash function, which must not be nil, and must not be changed.
Types
HashFn- HashFn computes an internal node's hash using the hashes of its child nodes.
VisitFn- VisitFn visits the node with the specified ID and hash.