Skip to main content

Transcript

Trait Transcript 

Source
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§

Source

type Config: Clone

Transcript::Config is the configuration for the underlying hash function of the transcript.

Source

type Gadget: TranscriptGadget<F, Widget = Self>

Transcript::Gadget is the in-circuit gadget corresponding to this widget.

Required Methods§

Source

fn new(config: Self::Config) -> Self

Transcript::new creates a new transcript / sponge under the given configuration config.

Source

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.

Source

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§

Source

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.

Source

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.

Source

fn get_bits(&mut self, num_bits: usize) -> Vec<bool>

Transcript::get_bits squeezes num_bits bits from the transcript / sponge.

Source

fn get_field_element(&mut self) -> F

Transcript::get_field_element squeezes a single field element from the transcript / sponge.

Source

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.

Source

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.

Source

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.

Source

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".

Implementations on Foreign Types§

Source§

impl<F: PrimeField> Transcript<F> for PoseidonSponge<F>

Source§

type Config = PoseidonConfig<F>

Source§

type Gadget = PoseidonSpongeVar<F>

Source§

fn new(config: Self::Config) -> Self

Source§

fn add_field_elements(&mut self, input: &[F]) -> &mut Self

Source§

fn get_field_elements(&mut self, num_elements: usize) -> Vec<F>

Implementors§