NamespaceMerkleHasher

Trait NamespaceMerkleHasher 

Source
pub trait NamespaceMerkleHasher<const NS_ID_SIZE: usize>: MerkleHash {
    // Required methods
    fn with_ignore_max_ns(ignore_max_ns: bool) -> Self;
    fn ignores_max_ns(&self) -> bool;
    fn hash_leaf_with_namespace(
        &self,
        data: &[u8],
        namespace: NamespaceId<NS_ID_SIZE>,
    ) -> <Self as MerkleHash>::Output;
}
Expand description

An extension of MerkleHash indicating that the hasher is namespace aware. This allows for the creation of namespaced merkle trees and namespaced merkle proofs.

Required Methods§

Source

fn with_ignore_max_ns(ignore_max_ns: bool) -> Self

Create a new hasher which ignores the max namespace

Source

fn ignores_max_ns(&self) -> bool

Check whether the hasher ignores the max namespace

Source

fn hash_leaf_with_namespace( &self, data: &[u8], namespace: NamespaceId<NS_ID_SIZE>, ) -> <Self as MerkleHash>::Output

Hash the given data and namespace

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<const NS_ID_SIZE: usize> NamespaceMerkleHasher<NS_ID_SIZE> for NamespacedSha2Hasher<NS_ID_SIZE>