pub trait Transcript<F: PrimeField>: Clone {
type Config: Clone;
type Gadget: TranscriptGadget<F, Widget = Self>;
// Required methods
fn new(config: Self::Config) -> Self;
fn add_field_elements(&mut self, input: &[F]) -> &mut Self;
fn get_field_elements(&mut self, num_elements: usize) -> Vec<F>;
// Provided methods
fn new_with_pp_hash(config: Self::Config, pp_hash: F) -> Self { ... }
fn add<A: Absorbable + ?Sized>(&mut self, input: &A) -> &mut Self { ... }
fn get_bits(&mut self, num_bits: usize) -> Vec<bool> { ... }
fn get_field_element(&mut self) -> F { ... }
fn separate_domain(&self, domain: &[u8]) -> Self { ... }
fn challenge_field_element(&mut self) -> F { ... }
fn challenge_bits(&mut self, num_bits: usize) -> Vec<bool> { ... }
fn challenge_field_elements(&mut self, n: usize) -> Vec<F> { ... }
}Expand description
Transcript is the out-of-circuit widget for transcripts and sponges.
Provers and verifiers can use this trait to absorb messages and squeeze challenges in a way that is agnostic to the underlying hash function.
Required Associated Types§
Sourcetype Config: Clone
type Config: Clone
Transcript::Config is the configuration for the underlying hash
function of the transcript.
Sourcetype Gadget: TranscriptGadget<F, Widget = Self>
type Gadget: TranscriptGadget<F, Widget = Self>
Transcript::Gadget is the in-circuit gadget corresponding to this
widget.
Required Methods§
Sourcefn new(config: Self::Config) -> Self
fn new(config: Self::Config) -> Self
Transcript::new creates a new transcript / sponge under the given
configuration config.
Sourcefn add_field_elements(&mut self, input: &[F]) -> &mut Self
fn add_field_elements(&mut self, input: &[F]) -> &mut Self
Transcript::add_field_elements absorbs a message input that is
represented as field elements into the transcript / sponge.
Sourcefn get_field_elements(&mut self, num_elements: usize) -> Vec<F>
fn get_field_elements(&mut self, num_elements: usize) -> Vec<F>
Transcript::get_field_elements squeezes num_elements field
elements from the transcript / sponge.
Provided Methods§
Sourcefn new_with_pp_hash(config: Self::Config, pp_hash: F) -> Self
fn new_with_pp_hash(config: Self::Config, pp_hash: F) -> Self
Transcript::new_with_pp_hash is a convenience method for creating a
new transcript / sponge under the given configuration config and
additionally absorbing a hash of the public parameters pp_hash.
Sourcefn add<A: Absorbable + ?Sized>(&mut self, input: &A) -> &mut Self
fn add<A: Absorbable + ?Sized>(&mut self, input: &A) -> &mut Self
Transcript::add absorbs a message input that can be any type
implementing the Absorbable trait into the transcript / sponge.
Sourcefn get_bits(&mut self, num_bits: usize) -> Vec<bool>
fn get_bits(&mut self, num_bits: usize) -> Vec<bool>
Transcript::get_bits squeezes num_bits bits from the transcript /
sponge.
Sourcefn get_field_element(&mut self) -> F
fn get_field_element(&mut self) -> F
Transcript::get_field_element squeezes a single field element from
the transcript / sponge.
Sourcefn separate_domain(&self, domain: &[u8]) -> Self
fn separate_domain(&self, domain: &[u8]) -> Self
Transcript::separate_domain creates a new transcript / sponge by
applying domain separation using the provided domain byte sequence.
Sourcefn challenge_field_element(&mut self) -> F
fn challenge_field_element(&mut self) -> F
Transcript::challenge_field_element squeezes a challenge from the
transcript as a field element.
Internally, it first squeezes a field element and then absorbs it back into the transcript to ensure security.
Sourcefn challenge_bits(&mut self, num_bits: usize) -> Vec<bool>
fn challenge_bits(&mut self, num_bits: usize) -> Vec<bool>
Transcript::challenge_bits squeezes a challenge from the transcript
as a bit vector.
Internally, it squeezes several field elements, absorbs them back to the transcript (for strong Fiat-Shamir), and decomposes them into bits.
Sourcefn challenge_field_elements(&mut self, n: usize) -> Vec<F>
fn challenge_field_elements(&mut self, n: usize) -> Vec<F>
Transcript::challenge_field_elements squeezes n challenges from
the transcript as field elements.
Internally, it first squeezes the field elements and then absorbs them back into the transcript to ensure security.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".