Skip to main content

HashToScalar

Trait HashToScalar 

Source
pub trait HashToScalar {
    type Input;
    type Output;

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

A trait for a hash function that projects the value to a scalar.

Required Associated Types§

Required Methods§

Source

fn hash_to_scalar(&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 RATE: usize> HashToScalar for Poseidon<E, RATE>
where E: Environment,

Source§

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

Returns a scalar from hashing the input. This method uses truncation (up to data bits) to project onto the scalar field.

Source§

type Input = Field<E>

Source§

type Output = Scalar<E>

Implementors§