pub trait LeafHash:
    Clone
    + Send
    + Sync {
    type Hash: Copy + Clone + Debug + Default + PartialEq + Eq + FromBytes + ToBytes + Send + Sync;
    type Leaf: Clone + Send + Sync;

    // Required method
    fn hash_leaf(&self, leaf: &Self::Leaf) -> Result<Self::Hash>;

    // Provided method
    fn hash_leaves(&self, leaves: &[Self::Leaf]) -> Result<Vec<Self::Hash>> { ... }
}
Expand description

A trait for a Merkle leaf hash function.

Required Associated Types§

Required Methods§

Source

fn hash_leaf(&self, leaf: &Self::Leaf) -> Result<Self::Hash>

Returns the hash of the given leaf node.

Provided Methods§

Source

fn hash_leaves(&self, leaves: &[Self::Leaf]) -> Result<Vec<Self::Hash>>

Returns the hash for each leaf node.

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.

Implementations on Foreign Types§

Source§

impl<E: Environment, const NUM_WINDOWS: u8, const WINDOW_SIZE: u8> LeafHash for BHP<E, NUM_WINDOWS, WINDOW_SIZE>

Source§

fn hash_leaf(&self, leaf: &Self::Leaf) -> Result<Self::Hash>

Returns the hash of the given leaf node.

Source§

type Hash = Field<E>

Source§

type Leaf = Vec<bool>

Source§

impl<E: Environment, const RATE: usize> LeafHash for Poseidon<E, RATE>

Source§

fn hash_leaf(&self, leaf: &Self::Leaf) -> Result<Self::Hash>

Returns the hash of the given leaf node.

Source§

type Hash = Field<E>

Source§

type Leaf = Vec<<Poseidon<E, RATE> as LeafHash>::Hash>

Source§

impl<const TYPE: u8, const VARIANT: usize> LeafHash for Keccak<TYPE, VARIANT>

Source§

fn hash_leaf(&self, leaf: &Self::Leaf) -> Result<Self::Hash>

Returns the hash of the given leaf node.

Source§

type Hash = BooleanHash<VARIANT>

Source§

type Leaf = Vec<bool>

Implementors§