pub enum ChallengeGenerator<F: PrimeField, S: CryptographicSponge> {
Multivariate(S),
Univariate(F, F),
}
Expand description
ChallengeGenerator
generates opening challenges using multivariate or univariate strategy.
For multivariate strategy, each challenge is freshly squeezed from a sponge.
For univariate strategy, each challenge is a power of one squeezed element from sponge.
Note that mutable reference cannot be cloned.
Variants§
Multivariate(S)
Each challenge is freshly squeezed from a sponge.
Univariate(F, F)
Each challenge is a power of one squeezed element from sponge.
Univariate(generator, next_element)
Implementations§
source§impl<F: PrimeField, S: CryptographicSponge> ChallengeGenerator<F, S>
impl<F: PrimeField, S: CryptographicSponge> ChallengeGenerator<F, S>
sourcepub fn new_multivariate(sponge: S) -> Self
pub fn new_multivariate(sponge: S) -> Self
Returns a challenge generator with multivariate strategy. Each challenge is freshly squeezed from a sponge.
sourcepub fn new_univariate(sponge: &mut S) -> Self
pub fn new_univariate(sponge: &mut S) -> Self
Returns a challenge generator with univariate strategy. Each challenge is a power of one squeezed element from sponge.
sourcepub fn try_next_challenge_of_size(&mut self, size: FieldElementSize) -> F
pub fn try_next_challenge_of_size(&mut self, size: FieldElementSize) -> F
Returns a challenge of size size
.
- If
self == Self::Multivariate(...)
, then this squeezes out a challenge of sizesize
. - If
self == Self::Univariate(...)
, then this ignores thesize
argument and simply squeezes out the next field element.
sourcepub fn next_challenge(&mut self) -> F
pub fn next_challenge(&mut self) -> F
Returns the next challenge generated.
sourcepub fn into_sponge(self) -> Option<S>
pub fn into_sponge(self) -> Option<S>
Returns the sponge state if self
is multivariate. Returns None
otherwise.
Trait Implementations§
source§impl<F: Clone + PrimeField, S: Clone + CryptographicSponge> Clone for ChallengeGenerator<F, S>
impl<F: Clone + PrimeField, S: Clone + CryptographicSponge> Clone for ChallengeGenerator<F, S>
source§fn clone(&self) -> ChallengeGenerator<F, S>
fn clone(&self) -> ChallengeGenerator<F, S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more