Trait mina_poseidon::sponge::FqSponge
source · 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§
sourcefn new(p: &'static ArithmeticSpongeParams<Fq>) -> Self
fn new(p: &'static ArithmeticSpongeParams<Fq>) -> Self
Creates a new sponge.
sourcefn absorb_fq(&mut self, x: &[Fq])
fn absorb_fq(&mut self, x: &[Fq])
Absorbs a base field element. This operation is the most straightforward and calls the underlying sponge directly.
sourcefn absorb_fr(&mut self, x: &[Fr])
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.
sourcefn challenge_fq(&mut self) -> Fq
fn challenge_fq(&mut self) -> Fq
Squeeze out a base field challenge. This operation is the most direct and calls the underlying sponge.
sourcefn challenge(&mut self) -> Fr
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.