Type Alias Poseidon2

Source
pub type Poseidon2<E> = Poseidon<E, 2>;
Expand description

Poseidon2 is a cryptographic hash function of input rate 2.

Aliased Type§

pub struct Poseidon2<E> { /* private fields */ }

Implementations

Source§

impl<E: Environment, const RATE: usize> Poseidon<E, RATE>

Source

pub fn setup(domain: &str) -> Result<Self>

Initializes a new instance of Poseidon.

Source

pub fn domain(&self) -> Field<E>

Returns the domain separator for the hash function.

Source

pub fn parameters(&self) -> &Arc<PoseidonParameters<E::Field, RATE, CAPACITY>>

Returns the Poseidon parameters for hashing.

Trait Implementations

Source§

impl<E: Clone + Environment, const RATE: usize> Clone for Poseidon<E, RATE>
where E::Field: Clone,

Source§

fn clone(&self) -> Poseidon<E, RATE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug + Environment, const RATE: usize> Debug for Poseidon<E, RATE>
where E::Field: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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

Source§

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

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

Source§

type Input = Field<E>

Source§

type Output = Field<E>

Source§

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

Source§

fn hash_many( &self, input: &[Self::Input], num_outputs: u16, ) -> Vec<Self::Output>

Returns the cryptographic hash for a list of field elements as input, and returns the specified number of field elements as output.

Source§

type Input = Field<E>

Source§

type Output = Field<E>

Source§

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

Source§

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

Returns a group element from hashing the input.

Source§

type Input = Field<E>

Source§

type Output = Group<E>

Source§

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

Source§

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

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>

Source§

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

Source§

type Input = Field<E>

Source§

type Output = Field<E>

Source§

type Seed = Field<E>

Source§

fn prf(&self, seed: &Self::Seed, input: &[Self::Input]) -> Result<Self::Output>

Returns the output for the given seed and input.
Source§

impl<E: PartialEq + Environment, const RATE: usize> PartialEq for Poseidon<E, RATE>
where E::Field: PartialEq,

Source§

fn eq(&self, other: &Poseidon<E, RATE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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