pub trait LeafHash: Clone + Send + Sync {
    type Hash: FieldTrait;
    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.

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, Global>

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, Global>

Implementors§