pub trait PathHash<E: Environment> {
    type Hash: Clone + Default + Inject<Primitive = <Self::Primitive as PathHash>::Hash> + Eject<Primitive = <Self::Primitive as PathHash>::Hash> + Equal<Output = Boolean<E>> + Ternary<Boolean = Boolean<E>, Output = Self::Hash>;
    type Primitive: PathHash;

    // Required method
    fn hash_children(&self, children: &[Self::Hash]) -> Self::Hash;

    // Provided method
    fn hash_empty<const ARITY: u8>(&self) -> Self::Hash { ... }
}
Expand description

A trait for a Merkle path hash function.

Required Associated Types§

Source

type Hash: Clone + Default + Inject<Primitive = <Self::Primitive as PathHash>::Hash> + Eject<Primitive = <Self::Primitive as PathHash>::Hash> + Equal<Output = Boolean<E>> + Ternary<Boolean = Boolean<E>, Output = Self::Hash>

Source

type Primitive: PathHash

Required Methods§

Source

fn hash_children(&self, children: &[Self::Hash]) -> Self::Hash

Returns the hash of the given child nodes.

Provided Methods§

Source

fn hash_empty<const ARITY: u8>(&self) -> Self::Hash

Returns the empty hash.

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> PathHash<E> for BHP<E, NUM_WINDOWS, WINDOW_SIZE>

Source§

fn hash_children(&self, children: &[Self::Hash]) -> Self::Hash

Returns the hash of the given child nodes.

Source§

type Hash = Field<E>

Source§

type Primitive = BHP<<E as Environment>::Network, NUM_WINDOWS, WINDOW_SIZE>

Source§

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

Source§

fn hash_children(&self, children: &[Self::Hash]) -> Self::Hash

Returns the hash of the given child nodes.

Source§

type Hash = Field<E>

Source§

type Primitive = Poseidon<<E as Environment>::Network, RATE>

Source§

impl<E: Environment, const TYPE: u8, const VARIANT: usize> PathHash<E> for Keccak<E, TYPE, VARIANT>

Source§

fn hash_children(&self, children: &[Self::Hash]) -> Self::Hash

Returns the hash of the given child nodes.

Source§

type Hash = BooleanHash<E, VARIANT>

Source§

type Primitive = Keccak<TYPE, VARIANT>

Implementors§