Trait mrkl::hash::NodeHasher
[−]
[src]
pub trait NodeHasher { type HashOutput; fn hash_children<'a, L>(
&'a self,
iter: Children<'a, Self::HashOutput, L>
) -> Self::HashOutput; }
An algorithm to compute a hash of a sequence of child nodes.
The abstraction provided by NodeHasher
is
agnostic to the implementation of the hash function, and allows different
ways of calculating the hash of child nodes for their parent node.
Associated Types
type HashOutput
The output of the hash function.
Required Methods
fn hash_children<'a, L>(
&'a self,
iter: Children<'a, Self::HashOutput, L>
) -> Self::HashOutput
&'a self,
iter: Children<'a, Self::HashOutput, L>
) -> Self::HashOutput
Hash a sequence of child nodes to produce the parent hash value.
This method is used to calculate hash values of the non-leaf nodes
in the Merkle tree under construction. The iterator retrieves at least
one node. When it's exactly one, this is likely to be the special
case described in the documentation to
Builder::chain_lone_child()
method.
The type parameter represents arbitrary list node data and should be ignored for all purposes.
Implementors
impl<D> NodeHasher for DefaultNodeHasher<D> where
D: Default,
D: Input + FixedOutput, type HashOutput = GenericArray<u8, D::OutputSize>;impl<D, Nh> NodeHasher for DigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>, type HashOutput = GenericArray<u8, D::OutputSize>;impl<D, Nh> NodeHasher for ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>, type HashOutput = GenericArray<u8, D::OutputSize>;