Overview
TheHasher trait defines the interface for hash functions in RotorTree. It supports streaming hash operations through an associated State type.
Trait Definition
Trait Bounds
Implementors must satisfy:Clone- Can be cloned cheaplySend- Can be sent across threadsSync- Can be shared across threads'static- Contains no non-static references
Associated Types
The streaming hash state type. Must implement the
HashState trait.Methods
new_state
Create a fresh hashing state for streaming operations.A new hash state ready to accept data via
update()HashState Trait
TheHashState trait defines the streaming interface:
update
Feed bytes into the hash state.Bytes to hash
finalize
Finalize the hash and return the digest. Consumes the state.32-byte hash digest (
[u8; 32])Implementing a Custom Hasher
Here’s how to implementHasher for a custom hash function:
Usage Example
Related Types
TreeHasher
Domain-separated wrapper for Merkle tree operations
Blake3Hasher
Built-in BLAKE3 implementation
