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§
Implementations on Foreign Types§
Source§impl<E, const RATE: usize> HashToScalar for Poseidon<E, RATE>where
E: Environment,
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>
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.