MerkleHash

Trait MerkleHash 

Source
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§

Source

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§

Source

type Output: Debug + PartialEq + Eq + Clone + Default + Hash + Ord

The output of this hasher.

Required Methods§

Source

fn hash_leaf(&self, data: &[u8]) -> Self::Output

Hashes data as a “leaf” of the tree. This operation should be domain separated.

Source

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.

Implementors§

Source§

impl MerkleHash for TmSha2Hasher

Source§

impl<const NS_ID_SIZE: usize> MerkleHash for NamespacedSha2Hasher<NS_ID_SIZE>

Source§

const EMPTY_ROOT: NamespacedHash<NS_ID_SIZE>

Source§

type Output = NamespacedHash<NS_ID_SIZE>