Struct mrkl::digest::ByteDigestHasher
[−]
[src]
pub struct ByteDigestHasher<D, Nh = DefaultNodeHasher<D>> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>, { /* fields omitted */ }
Provides a cryptographic hash function implementation for hashing Merkle trees with byte slice convertible input.
The hash function implementation is defined by the first type parameter.
In contrast to the more generic DigestHasher
, the parameter type is
bound by bytestream-oriented digest::Input
, so any cryptographic
digest function implementations conformant to this trait, plus
digest::FixedOutput
and Default
, are directly usable.
The implementation of a concatenated hash over node's children is defined by the second type parameter. The default choice should be good enough unless a specific way to derive concatenated hashes is required.
Methods
impl<D, Nh> ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Default,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Default,
impl<D, Nh> ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
fn with_node_hasher(node_hasher: Nh) -> Self
[src]
Constructs a new instance of the hash extractor taking an instance of the node hasher.
Trait Implementations
impl<D, Nh> Default for ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Default,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Default,
impl<D, Nh> Clone for ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Clone,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Clone,
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<D, Nh> Debug for ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Debug,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
Nh: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl<D, Nh, In: ?Sized> Hasher<In> for ByteDigestHasher<D, Nh> where
In: AsRef<[u8]>,
D: Default,
D: Input + FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
[src]
In: AsRef<[u8]>,
D: Default,
D: Input + FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
fn hash_input(&self, input: &In) -> Self::HashOutput
[src]
Hash an element of the input data. Read more
impl<D, Nh> NodeHasher for ByteDigestHasher<D, Nh> where
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
[src]
D: FixedOutput,
Nh: NodeHasher<HashOutput = GenericArray<u8, D::OutputSize>>,
type HashOutput = GenericArray<u8, D::OutputSize>
The output of the hash function.
fn hash_children<'a, L>(
&'a self,
iter: Children<'a, Self::HashOutput, L>
) -> Self::HashOutput
[src]
&'a self,
iter: Children<'a, Self::HashOutput, L>
) -> Self::HashOutput
Hash a sequence of child nodes to produce the parent hash value. Read more