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

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

    // Provided methods
    fn hash_empty<const ARITY: u8>(&self) -> Result<Self::Hash> { ... }
    fn hash_all_children(
        &self,
        child_nodes: &[&[Self::Hash]],
    ) -> Result<Vec<Self::Hash>> { ... }
}
Expand description

A trait for a Merkle path hash function.

Required Associated Types§

Required Methods§

Source

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

Returns the hash of the given child nodes.

Provided Methods§

Source

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

Returns the empty hash.

Source

fn hash_all_children( &self, child_nodes: &[&[Self::Hash]], ) -> Result<Vec<Self::Hash>>

Returns the hash for each child 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> PathHash for BHP<E, NUM_WINDOWS, WINDOW_SIZE>

Source§

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

Returns the hash of the given child nodes.

Source§

type Hash = Field<E>

Source§

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

Source§

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

Returns the hash of the given child nodes.

Source§

type Hash = Field<E>

Source§

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

Source§

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

Returns the hash of the given child nodes.

Source§

type Hash = BooleanHash<VARIANT>

Implementors§