Skip to main content

Hash

Trait Hash 

Source
pub trait Hash {
    type Input;
    type Output;

    // Required method
    fn hash(&self, input: &[Self::Input]) -> Result<Self::Output, Error>;
}
Expand description

A trait for a hash function.

Required Associated Types§

Required Methods§

Source

fn hash(&self, input: &[Self::Input]) -> Result<Self::Output, Error>

Returns the hash of the given input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<E, const NUM_BITS: u8> Hash for Pedersen<E, NUM_BITS>
where E: Environment,

Source§

fn hash( &self, input: &[<Pedersen<E, NUM_BITS> as Hash>::Input], ) -> Result<<Pedersen<E, NUM_BITS> as Hash>::Output, Error>

Returns the Pedersen hash of the given input as a field element.

Source§

type Input = bool

Source§

type Output = Field<E>

Source§

impl<E, const NUM_WINDOWS: u8, const WINDOW_SIZE: u8> Hash for BHP<E, NUM_WINDOWS, WINDOW_SIZE>
where E: Environment,

Source§

fn hash( &self, input: &[<BHP<E, NUM_WINDOWS, WINDOW_SIZE> as Hash>::Input], ) -> Result<<BHP<E, NUM_WINDOWS, WINDOW_SIZE> as Hash>::Output, Error>

Returns the BHP hash of the given input as a field element.

Source§

type Input = bool

Source§

type Output = Field<E>

Source§

impl<E, const RATE: usize> Hash for Poseidon<E, RATE>
where E: Environment,

Source§

fn hash( &self, input: &[<Poseidon<E, RATE> as Hash>::Input], ) -> Result<<Poseidon<E, RATE> as Hash>::Output, Error>

Returns the cryptographic hash for a list of field elements as input.

Source§

type Input = Field<E>

Source§

type Output = Field<E>

Source§

impl<const TYPE: u8, const VARIANT: usize> Hash for Keccak<TYPE, VARIANT>

Source§

fn hash( &self, input: &[<Keccak<TYPE, VARIANT> as Hash>::Input], ) -> Result<<Keccak<TYPE, VARIANT> as Hash>::Output, Error>

Returns the Keccak hash of the given input as bits.

Source§

type Input = bool

Source§

type Output = Vec<bool>

Implementors§