Trait nmt_rs::simple_merkle::tree::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 Types§

source

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

The output of this hasher.

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 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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl MerkleHash for TmSha2Hasher

§

type Output = [u8; 32]

source§

const EMPTY_ROOT: Self::Output = _

source§

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

§

type Output = NamespacedHash<NS_ID_SIZE>

source§

const EMPTY_ROOT: NamespacedHash<NS_ID_SIZE> = _