# Functions
New creates a reusable BMT Hasher that pulls a new tree from a resource pool for hashing each chunk.
NewRefHasher returns a new RefHasher.
NewTreePool creates a tree pool with hasher, segment size, segment count and capacity on Hasher.getTree it reuses free trees or creates a new one if capacity is not reached.
# Constants
PoolSize is the maximum number of bmt trees used by the hashers, i.e, the maximum number of concurrent BMT hashing operations performed by the same hasher.
# Structs
AsyncHasher extends BMT Hasher with an asynchronous segment/section writer interface AsyncHasher is unsafe and does not check indexes and section data lengths it must be used with the right indexes and length and the right number of sections
behaviour is undefined if * non-final sections are shorter or longer than secsize * if final section does not match length * write a section with index that is higher than length/secsize * set length in Sum call when length/secsize < maxsec
* if Sum() is not called on a Hasher that is fully written a process will block, can be terminated with Reset * it will not leak processes if not all sections are written but it blocks and keeps the resource which can be released calling Reset().
Hasher a reusable hasher for fixed maximum size chunks representing a BMT - implements the hash.Hash interface - reuses a pool of trees for amortised memory allocation and resource control - supports order-agnostic concurrent segment writes and section (double segment) writes as well as sequential read and write - the same hasher instance must not be called concurrently on more than one chunk - the same hasher instance is synchronously reuseable - Sum gives back the tree to the pool and guaranteed to leave the tree and itself in a state reusable for hashing a new chunk - generates and verifies segment inclusion proofs (TODO:).
RefHasher is the non-optimized easy-to-read reference implementation of BMT.
TreePool provides a pool of trees used as resources by the BMT Hasher.
# Interfaces
SectionWriter is an asynchronous segment/section writer interface.
# Type aliases
BaseHasherFunc is a hash.Hash constructor function used for the base hash of the BMT.