pub struct PoseidonSpongeGadget<F: PrimeField, const RATE: usize, const CAPACITY: usize> {
pub parameters: Arc<PoseidonParameters<F, RATE, CAPACITY>>,
pub state: Vec<FpGadget<F>>,
pub mode: DuplexSpongeMode,
}
Expand description
the gadget for Poseidon sponge
This implementation of Poseidon is entirely from Fractal’s implementation in COS20 with small syntax changes.
Fields
parameters: Arc<PoseidonParameters<F, RATE, CAPACITY>>
Sponge Parameters
state: Vec<FpGadget<F>>
the sponge’s state
mode: DuplexSpongeMode
the mode
Trait Implementations
sourceimpl<F: PoseidonDefaultParametersField, const RATE: usize, const CAPACITY: usize> AlgebraicSpongeVar<F, PoseidonSponge<F, RATE, CAPACITY>, RATE, CAPACITY> for PoseidonSpongeGadget<F, RATE, CAPACITY>
impl<F: PoseidonDefaultParametersField, const RATE: usize, const CAPACITY: usize> AlgebraicSpongeVar<F, PoseidonSponge<F, RATE, CAPACITY>, RATE, CAPACITY> for PoseidonSpongeGadget<F, RATE, CAPACITY>
type Parameters = Arc<PoseidonParameters<F, RATE, CAPACITY>>
type Parameters = Arc<PoseidonParameters<F, RATE, CAPACITY>>
Parameters used by the sponge.
sourcefn with_parameters<CS: ConstraintSystem<F>>(
cs: CS,
parameters: &Self::Parameters
) -> Self
fn with_parameters<CS: ConstraintSystem<F>>(
cs: CS,
parameters: &Self::Parameters
) -> Self
Initialize a new instance of the sponge.
fn constant<CS: ConstraintSystem<F>>(
cs: CS,
pfs: &PoseidonSponge<F, RATE, CAPACITY>
) -> Self
sourcefn absorb<'a, CS: ConstraintSystem<F>, I: Iterator<Item = &'a FpGadget<F>>>(
&mut self,
cs: CS,
input: I
) -> Result<(), SynthesisError>
fn absorb<'a, CS: ConstraintSystem<F>, I: Iterator<Item = &'a FpGadget<F>>>(
&mut self,
cs: CS,
input: I
) -> Result<(), SynthesisError>
Absorb an input into the sponge.
sourcefn squeeze_field_elements<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
num_elements: usize
) -> Result<Vec<FpGadget<F>>, SynthesisError>
fn squeeze_field_elements<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
num_elements: usize
) -> Result<Vec<FpGadget<F>>, SynthesisError>
Squeeze num_elements
field elements from the sponge.
sourceimpl<F: PoseidonDefaultParametersField, const RATE: usize, const CAPACITY: usize> AllocGadget<PoseidonParameters<F, RATE, CAPACITY>, F> for PoseidonSpongeGadget<F, RATE, CAPACITY>
impl<F: PoseidonDefaultParametersField, const RATE: usize, const CAPACITY: usize> AllocGadget<PoseidonParameters<F, RATE, CAPACITY>, F> for PoseidonSpongeGadget<F, RATE, CAPACITY>
fn alloc_constant<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<PoseidonParameters<F, RATE, CAPACITY>>, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError>
fn alloc<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<PoseidonParameters<F, RATE, CAPACITY>>, CS: ConstraintSystem<F>>(
_cs: CS,
_value_gen: Fn
) -> Result<Self, SynthesisError>
fn alloc_input<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<PoseidonParameters<F, RATE, CAPACITY>>, CS: ConstraintSystem<F>>(
_cs: CS,
_value_gen: Fn
) -> Result<Self, SynthesisError>
fn alloc_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_input_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
sourceimpl<F: Clone + PrimeField, const RATE: usize, const CAPACITY: usize> Clone for PoseidonSpongeGadget<F, RATE, CAPACITY>
impl<F: Clone + PrimeField, const RATE: usize, const CAPACITY: usize> Clone for PoseidonSpongeGadget<F, RATE, CAPACITY>
sourcefn clone(&self) -> PoseidonSpongeGadget<F, RATE, CAPACITY>
fn clone(&self) -> PoseidonSpongeGadget<F, RATE, CAPACITY>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<F: PoseidonDefaultParametersField, const RATE: usize> DefaultCapacityAlgebraicSpongeVar<F, PoseidonSponge<F, RATE, 1_usize>, RATE> for PoseidonSpongeGadget<F, RATE, 1>
Auto Trait Implementations
impl<F, const RATE: usize, const CAPACITY: usize> RefUnwindSafe for PoseidonSpongeGadget<F, RATE, CAPACITY> where
F: RefUnwindSafe,
impl<F, const RATE: usize, const CAPACITY: usize> Send for PoseidonSpongeGadget<F, RATE, CAPACITY>
impl<F, const RATE: usize, const CAPACITY: usize> Sync for PoseidonSpongeGadget<F, RATE, CAPACITY>
impl<F, const RATE: usize, const CAPACITY: usize> Unpin for PoseidonSpongeGadget<F, RATE, CAPACITY> where
F: Unpin,
impl<F, const RATE: usize, const CAPACITY: usize> UnwindSafe for PoseidonSpongeGadget<F, RATE, CAPACITY> where
F: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more