Trait miden_core::crypto::hash::Hasher
source · pub trait Hasher {
type Digest: Digest;
const COLLISION_RESISTANCE: u32;
// Required methods
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 defines 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§
Required Associated Constants§
sourceconst COLLISION_RESISTANCE: u32
const COLLISION_RESISTANCE: u32
Collision resistance of the hash function measured in bits.
Required Methods§
sourcefn merge(values: &[Self::Digest; 2]) -> Self::Digest
fn merge(values: &[Self::Digest; 2]) -> Self::Digest
Returns a hash of two digests. This method is intended for use in construction of Merkle trees.
sourcefn merge_with_int(seed: Self::Digest, value: u64) -> Self::Digest
fn merge_with_int(seed: Self::Digest, value: u64) -> Self::Digest
Returns hash(seed
|| value
). This method is intended for use in PRNG and PoW contexts.
Object Safety§
This trait is not object safe.