Trait winter_crypto::Hasher

source ·
pub trait Hasher {
    type Digest: Digest;

    fn hash(bytes: &[u8]) -> Self::Digest;
    fn merge(values: &[Self::Digest; 2]) -> Self::Digest;
    fn merge_with_int(seed: Self::Digest, value: u64) -> Self::Digest;
}
Expand description

Defines a cryptographic hash function.

This trait defined hash procedures for the following inputs:

  • A sequence of bytes.
  • Two digests - this is intended for use in Merkle tree constructions.
  • A digests and a u64 value - this intended for use in PRNG or PoW contexts.

Required Associated Types

Specifies a digest type returned by this hasher.

Required Methods

Returns a hash of the provided sequence of bytes.

Returns a hash of two digests. This method is intended for use in construction of Merkle trees.

Returns hash(seed || value). This method is intended for use in PRNG and PoW contexts.

Implementors