Skip to main content

FqSponge

Trait FqSponge 

Source
pub trait FqSponge<Fq: Field, G, Fr, const FULL_ROUNDS: usize> {
    // Required methods
    fn new(p: &'static ArithmeticSpongeParams<Fq, FULL_ROUNDS>) -> Self;
    fn absorb_fq(&mut self, x: &[Fq]);
    fn absorb_g(&mut self, g: &[G]);
    fn absorb_fr(&mut self, x: &[Fr]);
    fn challenge_fq(&mut self) -> Fq;
    fn challenge(&mut self) -> Fr;
    fn digest_fq(self) -> Fq;
    fn digest(self) -> Fr;
}
Expand description

Abstracts a sponge operating on a base field Fq of the curve G. The parameter Fr is modelling the scalar field of the curve.

Required Methods§

Source

fn new(p: &'static ArithmeticSpongeParams<Fq, FULL_ROUNDS>) -> Self

Creates a new sponge.

Source

fn absorb_fq(&mut self, x: &[Fq])

Absorbs a base field element. This operation is the most straightforward and calls the underlying sponge directly.

Source

fn absorb_g(&mut self, g: &[G])

Absorbs a base field point, that is a pair of Fq elements. In the case of the point to infinity, the values (0, 0) are absorbed.

Source

fn absorb_fr(&mut self, x: &[Fr])

Absorbs an element of the scalar field Fr — it is done by converting the element to the base field first.

Source

fn challenge_fq(&mut self) -> Fq

Squeeze out a base field challenge. This operation is the most direct and calls the underlying sponge.

Source

fn challenge(&mut self) -> Fr

Squeeze out a challenge in the scalar field. Implemented by squeezing out base points and then converting them to a scalar field element using binary representation.

Source

fn digest_fq(self) -> Fq

Returns a base field digest by squeezing the underlying sponge directly.

Source

fn digest(self) -> Fr

Returns a scalar field digest using the binary representation technique.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<P: SWCurveConfig, SC: SpongeConstants, const FULL_ROUNDS: usize> FqSponge<<P as CurveConfig>::BaseField, Affine<P>, <P as CurveConfig>::ScalarField, FULL_ROUNDS> for DefaultFqSponge<P, SC, FULL_ROUNDS>
where P::BaseField: PrimeField, <P::BaseField as PrimeField>::BigInt: Into<<P::ScalarField as PrimeField>::BigInt>,