pub trait MerkleHash {
type Output: Debug + PartialEq + Eq + Clone + Default + Hash + Ord;
const EMPTY_ROOT: Self::Output;
// Required methods
fn hash_leaf(&self, data: &[u8]) -> Self::Output;
fn hash_nodes(&self, l: &Self::Output, r: &Self::Output) -> Self::Output;
}Expand description
A trait for hashing data into a merkle tree
Required Associated Constants§
Sourceconst EMPTY_ROOT: Self::Output
const EMPTY_ROOT: Self::Output
The hash of the empty tree. This is often defined as the hash of the empty string.
Required Associated Types§
Required Methods§
Sourcefn hash_leaf(&self, data: &[u8]) -> Self::Output
fn hash_leaf(&self, data: &[u8]) -> Self::Output
Hashes data as a “leaf” of the tree. This operation should be domain separated.
Sourcefn hash_nodes(&self, l: &Self::Output, r: &Self::Output) -> Self::Output
fn hash_nodes(&self, l: &Self::Output, r: &Self::Output) -> Self::Output
Hashes two digests into one. This operation should be domain separated.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.