Trait snarkvm_algorithms::traits::merkle_tree::MerkleParameters[][src]

pub trait MerkleParameters: Clone + Default {
    type H: CRH;

    const DEPTH: usize;

    fn setup<R: Rng>(rng: &mut R) -> Self;
fn crh(&self) -> &Self::H;
fn parameters(&self) -> &<Self::H as CRH>::Parameters; fn hash_leaf<L: ToBytes>(
        &self,
        leaf: &L,
        buffer: &mut [u8]
    ) -> Result<<Self::H as CRH>::Output, MerkleError> { ... }
fn hash_inner_node(
        &self,
        left: &<Self::H as CRH>::Output,
        right: &<Self::H as CRH>::Output,
        buffer: &mut [u8]
    ) -> Result<<Self::H as CRH>::Output, MerkleError> { ... }
fn hash_empty(&self) -> Result<<Self::H as CRH>::Output, MerkleError> { ... } }

Associated Types

type H: CRH[src]

Loading content...

Associated Constants

Loading content...

Required methods

fn setup<R: Rng>(rng: &mut R) -> Self[src]

Setup the MerkleParameters

fn crh(&self) -> &Self::H[src]

Returns the collision-resistant hash function used by the Merkle tree.

fn parameters(&self) -> &<Self::H as CRH>::Parameters[src]

Returns the collision-resistant hash function parameters used by the Merkle tree.

Loading content...

Provided methods

fn hash_leaf<L: ToBytes>(
    &self,
    leaf: &L,
    buffer: &mut [u8]
) -> Result<<Self::H as CRH>::Output, MerkleError>
[src]

Returns the hash of a given leaf.

fn hash_inner_node(
    &self,
    left: &<Self::H as CRH>::Output,
    right: &<Self::H as CRH>::Output,
    buffer: &mut [u8]
) -> Result<<Self::H as CRH>::Output, MerkleError>
[src]

Returns the output hash, given a left and right hash value.

fn hash_empty(&self) -> Result<<Self::H as CRH>::Output, MerkleError>[src]

Loading content...

Implementors

Loading content...