miden_crypto::hash

Trait 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 Constants§

source

const COLLISION_RESISTANCE: u32

Collision resistance of the hash function measured in bits.

Required Associated Types§

source

type Digest: Digest

Specifies a digest type returned by this hasher.

Required Methods§

source

fn hash(bytes: &[u8]) -> Self::Digest

Returns a hash of the provided sequence of bytes.

source

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.

source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

source§

impl Hasher for Blake3_160

source§

impl Hasher for miden_crypto::hash::blake::Blake3_192

source§

impl Hasher for miden_crypto::hash::blake::Blake3_256

source§

impl Hasher for Rp62_248

source§

const COLLISION_RESISTANCE: u32 = 124u32

source§

type Digest = ElementDigest

source§

impl Hasher for Rp64_256

source§

const COLLISION_RESISTANCE: u32 = 128u32

source§

type Digest = ElementDigest

source§

impl Hasher for RpJive64_256

source§

const COLLISION_RESISTANCE: u32 = 128u32

source§

type Digest = ElementDigest

source§

impl Hasher for Rpo256

source§

impl Hasher for Rpx256

source§

impl<B> Hasher for winter_crypto::hash::blake::Blake3_192<B>
where B: StarkField,

source§

const COLLISION_RESISTANCE: u32 = 96u32

source§

type Digest = ByteDigest<24>

source§

impl<B> Hasher for winter_crypto::hash::blake::Blake3_256<B>
where B: StarkField,

source§

const COLLISION_RESISTANCE: u32 = 128u32

source§

type Digest = ByteDigest<32>

source§

impl<B> Hasher for Sha3_256<B>
where B: StarkField,

source§

const COLLISION_RESISTANCE: u32 = 128u32

source§

type Digest = ByteDigest<32>