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.

Object Safety§

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.

§

type Hash = Field<E>

§

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.

§

type Hash = Field<E>

§

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.

§

type Hash = BooleanHash<VARIANT>

§

type Leaf = Vec<bool>

Implementors§