Trait snarkvm_marlin::fiat_shamir::traits::AlgebraicSpongeVar
source · [−]pub trait AlgebraicSpongeVar<CF, S, const RATE: usize, const CAPACITY: usize>: Clone where
CF: PrimeField,
S: AlgebraicSponge<CF, RATE, CAPACITY>, {
type Parameters;
fn with_parameters<CS>(
cs: CS,
params: &<S as AlgebraicSponge<CF, RATE, CAPACITY>>::Parameters
) -> Self
where
CS: ConstraintSystem<CF>;
fn constant<CS>(cs: CS, sponge: &S) -> Self
where
CS: ConstraintSystem<CF>;
fn absorb<'a, CS, I>(
&mut self,
cs: CS,
input: I
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<CF>,
I: Iterator<Item = &'a FpGadget<CF>>;
fn squeeze_field_elements<CS>(
&mut self,
cs: CS,
num_elements: usize
) -> Result<Vec<FpGadget<CF>, Global>, SynthesisError>
where
CS: ConstraintSystem<CF>;
}
Expand description
The interface for a cryptographic sponge constraints on field CF
.
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.
Associated Types
type Parameters
type Parameters
Parameters used by the sponge.
Required methods
fn with_parameters<CS>(
cs: CS,
params: &<S as AlgebraicSponge<CF, RATE, CAPACITY>>::Parameters
) -> Self where
CS: ConstraintSystem<CF>,
fn with_parameters<CS>(
cs: CS,
params: &<S as AlgebraicSponge<CF, RATE, CAPACITY>>::Parameters
) -> Self where
CS: ConstraintSystem<CF>,
Initialize a new instance of the sponge.
fn constant<CS>(cs: CS, sponge: &S) -> Self where
CS: ConstraintSystem<CF>,
fn absorb<'a, CS, I>(&mut self, cs: CS, input: I) -> Result<(), SynthesisError> where
CS: ConstraintSystem<CF>,
I: Iterator<Item = &'a FpGadget<CF>>,
fn absorb<'a, CS, I>(&mut self, cs: CS, input: I) -> Result<(), SynthesisError> where
CS: ConstraintSystem<CF>,
I: Iterator<Item = &'a FpGadget<CF>>,
Absorb an input into the sponge.
fn squeeze_field_elements<CS>(
&mut self,
cs: CS,
num_elements: usize
) -> Result<Vec<FpGadget<CF>, Global>, SynthesisError> where
CS: ConstraintSystem<CF>,
fn squeeze_field_elements<CS>(
&mut self,
cs: CS,
num_elements: usize
) -> Result<Vec<FpGadget<CF>, Global>, SynthesisError> where
CS: ConstraintSystem<CF>,
Squeeze num_elements
field elements from the sponge.