Skip to main content

CryptographicHasher

Trait CryptographicHasher 

Source
pub trait CryptographicHasher<Item: Clone, Out>: Clone {
    // Required method
    fn hash_iter<I>(&self, input: I) -> Out
       where I: IntoIterator<Item = Item>;

    // Provided methods
    fn hash_iter_slices<'a, I>(&self, input: I) -> Out
       where I: IntoIterator<Item = &'a [Item]>,
             Item: 'a { ... }
    fn hash_slice(&self, input: &[Item]) -> Out { ... }
    fn hash_item(&self, input: Item) -> Out { ... }
}
Expand description

A generic trait for cryptographic hashers that consume an arbitrary sequence of input items and produce a fixed-size output.

This trait abstracts over hash functions in a flexible way, supporting both field elements, scalars, or any other data type that implements Clone.

Required Methods§

Source

fn hash_iter<I>(&self, input: I) -> Out
where I: IntoIterator<Item = Item>,

Hash an iterator of input items.

§Arguments
  • input: An iterator over items to be hashed.
§Returns

A fixed-size digest of type Out.

Provided Methods§

Source

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items.

§Arguments
  • input: An iterator over slices of items to hash.
§Returns

A fixed-size digest of type Out.

Source

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items.

§Arguments
  • input: A slice of items to hash.
§Returns

A fixed-size digest of type Out.

Source

fn hash_item(&self, input: Item) -> Out

Hash a single item.

§Arguments
  • input: A single item to hash.
§Returns

A fixed-size digest of type Out.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u8; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u8; M], [[u8; M]; N]>,

Source§

impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u32; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u32; M], [[u32; M]; N]>,

Source§

impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u64; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u64; M], [[u64; M]; N]>,

Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u8; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u8, [u8; N]>,

Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u32; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u32, [u32; N]>,

Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u64; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u64, [u64; N]>,

Source§

impl<F, PF, P, const WIDTH: usize, const RATE: usize, const OUT: usize> CryptographicHasher<F, [PF; OUT]> for MultiField32PaddingFreeSponge<F, PF, P, WIDTH, RATE, OUT>

Source§

impl<T, P, const WIDTH: usize, const RATE: usize, const OUT: usize> CryptographicHasher<T, [T; OUT]> for PaddingFreeSponge<P, WIDTH, RATE, OUT>