pub trait FqSponge<Fq: Field, G, Fr> {
    // Required methods
    fn new(p: &'static ArithmeticSpongeParams<Fq>) -> 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>) -> 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.

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.

Implementors§

source§

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