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_g(&mut self, g: &[G])
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.
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.