pub trait AlgebraicSponge<F: PrimeField, const RATE: usize>: Clone + Debug {
    type Parameters;

    // Required methods
    fn sample_parameters() -> Self::Parameters;
    fn new_with_parameters(params: &Self::Parameters) -> Self;
    fn absorb_native_field_elements<T: ToConstraintField<F>>(
        &mut self,
        elements: &[T]
    );
    fn absorb_nonnative_field_elements<Target: PrimeField>(
        &mut self,
        elements: impl IntoIterator<Item = Target>
    );
    fn squeeze_native_field_elements(&mut self, num: usize) -> SmallVec<[F; 10]>;
    fn squeeze_nonnative_field_elements<Target: PrimeField>(
        &mut self,
        num: usize
    ) -> SmallVec<[Target; 10]>;
    fn squeeze_short_nonnative_field_elements<Target: PrimeField>(
        &mut self,
        num: usize
    ) -> SmallVec<[Target; 10]>;

    // Provided methods
    fn new() -> Self { ... }
    fn absorb_bytes(&mut self, elements: &[u8]) { ... }
    fn squeeze_short_nonnative_field_element<Target: PrimeField>(
        &mut self
    ) -> Target { ... }
}
Expand description

The interface for a cryptographic sponge. A sponge can absorb or take in inputs and later squeeze or output bytes or field elements. The outputs are dependent on previous absorb and squeeze calls.

Required Associated Types§

source

type Parameters

Parameters used by the sponge.

Required Methods§

source

fn sample_parameters() -> Self::Parameters

source

fn new_with_parameters(params: &Self::Parameters) -> Self

Initialize a new instance of the sponge.

source

fn absorb_native_field_elements<T: ToConstraintField<F>>( &mut self, elements: &[T] )

Takes in field elements.

source

fn absorb_nonnative_field_elements<Target: PrimeField>( &mut self, elements: impl IntoIterator<Item = Target> )

Takes in field elements.

source

fn squeeze_native_field_elements(&mut self, num: usize) -> SmallVec<[F; 10]>

Takes in field elements.

source

fn squeeze_nonnative_field_elements<Target: PrimeField>( &mut self, num: usize ) -> SmallVec<[Target; 10]>

Takes out field elements.

source

fn squeeze_short_nonnative_field_elements<Target: PrimeField>( &mut self, num: usize ) -> SmallVec<[Target; 10]>

Takes out field elements of 168 bits.

Provided Methods§

source

fn new() -> Self

Initialize a new instance of the sponge.

source

fn absorb_bytes(&mut self, elements: &[u8])

Takes in bytes.

source

fn squeeze_short_nonnative_field_element<Target: PrimeField>( &mut self ) -> Target

Takes out a field element of 168 bits.

Implementors§

source§

impl<F: PrimeField, const RATE: usize> AlgebraicSponge<F, RATE> for PoseidonSponge<F, RATE, 1>