pub struct DuplexSponge<F, P, const WIDTH: usize, const RATE: usize> { /* private fields */ }Expand description
Permutation-based duplex sponge in overwrite mode.
“Duplex” refers to being able to alternately absorb (observe) and squeeze (sample), rather than a single absorb phase followed by a single squeeze phase.
This variant operates in overwrite mode, meaning new inputs overwrite state elements directly (instead of, e.g., being added in).
Implementations§
Source§impl<F, P, const WIDTH: usize, const RATE: usize> DuplexSponge<F, P, WIDTH, RATE>
impl<F, P, const WIDTH: usize, const RATE: usize> DuplexSponge<F, P, WIDTH, RATE>
pub fn state(&self) -> &[F; WIDTH]
pub fn absorb_idx(&self) -> usize
pub fn sample_idx(&self) -> usize
Source§impl<F, P, const WIDTH: usize, const RATE: usize> DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
impl<F, P, const WIDTH: usize, const RATE: usize> DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
Trait Implementations§
Source§impl<F, P, const WIDTH: usize, const RATE: usize> CanObserve<F> for DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
impl<F, P, const WIDTH: usize, const RATE: usize> CanObserve<F> for DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
Source§impl<F, P, const WIDTH: usize, const RATE: usize, const N: usize> CanObserve<[F; N]> for DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
impl<F, P, const WIDTH: usize, const RATE: usize, const N: usize> CanObserve<[F; N]> for DuplexSponge<F, P, WIDTH, RATE>where
F: Copy,
P: CryptographicPermutation<[F; WIDTH]>,
Source§impl<F: Clone, P: Clone, const WIDTH: usize, const RATE: usize> Clone for DuplexSponge<F, P, WIDTH, RATE>
impl<F: Clone, P: Clone, const WIDTH: usize, const RATE: usize> Clone for DuplexSponge<F, P, WIDTH, RATE>
Source§fn clone(&self) -> DuplexSponge<F, P, WIDTH, RATE>
fn clone(&self) -> DuplexSponge<F, P, WIDTH, RATE>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Debug, P: Debug, const WIDTH: usize, const RATE: usize> Debug for DuplexSponge<F, P, WIDTH, RATE>
impl<F: Debug, P: Debug, const WIDTH: usize, const RATE: usize> Debug for DuplexSponge<F, P, WIDTH, RATE>
Source§impl<SC, F, P, const WIDTH: usize, const RATE: usize> FiatShamirTranscript<SC> for DuplexSponge<F, P, WIDTH, RATE>where
F: PrimeField,
SC: StarkProtocolConfig<Digest = [F; RATE], F = F>,
P: CryptographicPermutation<[F; WIDTH]> + Send + Sync,
impl<SC, F, P, const WIDTH: usize, const RATE: usize> FiatShamirTranscript<SC> for DuplexSponge<F, P, WIDTH, RATE>where
F: PrimeField,
SC: StarkProtocolConfig<Digest = [F; RATE], F = F>,
P: CryptographicPermutation<[F; WIDTH]> + Send + Sync,
fn observe(&mut self, value: F)
fn sample(&mut self) -> F
Source§fn observe_commit(&mut self, digest: [F; RATE])
fn observe_commit(&mut self, digest: [F; RATE])
Implementations should pass through to Self::observe, but no default implementation is
provided since an explicit conversion from
Digest to array of F is required.fn observe_ext(&mut self, value: SC::EF)
fn sample_ext(&mut self) -> SC::EF
Source§fn sample_bits(&mut self, bits: usize) -> u64
fn sample_bits(&mut self, bits: usize) -> u64
Samples and returns an integer in the range [0, 2^bits). Read more
Source§fn check_witness(&mut self, bits: usize, witness: SC::F) -> bool
fn check_witness(&mut self, bits: usize, witness: SC::F) -> bool
Checks a proof-of-work witness: observes
witness into the transcript and accepts iff the
next Self::sample_bits is zero (probability ≈ 2^{-bits} for a random witness, so
Self::grind tries ≈ 2^bits witnesses to find one). Read moreAuto Trait Implementations§
impl<F, P, const WIDTH: usize, const RATE: usize> Freeze for DuplexSponge<F, P, WIDTH, RATE>
impl<F, P, const WIDTH: usize, const RATE: usize> RefUnwindSafe for DuplexSponge<F, P, WIDTH, RATE>where
P: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, P, const WIDTH: usize, const RATE: usize> Send for DuplexSponge<F, P, WIDTH, RATE>
impl<F, P, const WIDTH: usize, const RATE: usize> Sync for DuplexSponge<F, P, WIDTH, RATE>
impl<F, P, const WIDTH: usize, const RATE: usize> Unpin for DuplexSponge<F, P, WIDTH, RATE>
impl<F, P, const WIDTH: usize, const RATE: usize> UnsafeUnpin for DuplexSponge<F, P, WIDTH, RATE>where
P: UnsafeUnpin,
F: UnsafeUnpin,
impl<F, P, const WIDTH: usize, const RATE: usize> UnwindSafe for DuplexSponge<F, P, WIDTH, RATE>where
P: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more