Trait merkle_light::hash::Algorithm [] [src]

pub trait Algorithm<T>: Hasher where
    T: Ord + Clone + Default + Debug
{ fn write_t(&mut self, i: T);
fn hash(&self) -> T;
fn reset(&mut self); fn empty(&mut self) -> T { ... }
fn leaf(&mut self, leaf: T) -> T { ... }
fn node(&mut self, left: T, right: T) -> T { ... } }

Hashing algorithm type.

Algorithm conforms standard [Hasher] trait and provides methods to return hash and resetting current state.

T is a hash item must be of known size at compile time, globally ordered, with default value as a neutral element of the hash space. Neutral element is interpreted as 0 or nil and required for evaluation of merkle tree.

TODO: #[inline]

Required Methods

Writes a single T into this hasher.

Returns the hash value for the data stream written so far.

Reset Hasher state.

Provided Methods

Returns digest of the empty thing.

Returns the hash value for MT leaf (prefix 0x00).

Returns the hash value for MT interior node (prefix 0x01).

Implementors