Skip to main content

HashFunction

Trait HashFunction 

Source
pub trait HashFunction:
    Default
    + Send
    + Sync
    + 'static {
    const NAME: &'static str;
    const DIGEST_FELTS: usize;

    // Required method
    fn hash(input: &[u8]) -> Vec<u8> ;
}
Expand description

The byte-level hash backing a HashPrecompile.

Required Associated Constants§

Source

const NAME: &'static str

Stable name hashed into the precompile id; renaming changes every tag it owns.

Source

const DIGEST_FELTS: usize

u32-packed-LE felts in the digest (8 for a 256-bit hash, 16 for 512-bit).

Required Methods§

Source

fn hash(input: &[u8]) -> Vec<u8>

Hashes input, returning the digest as DIGEST_FELTS * 4 bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§