Skip to main content

TranscriptEngineTrait

Trait TranscriptEngineTrait 

Source
pub trait TranscriptEngineTrait<E: Engine>: Send + Sync {
    // Required methods
    fn new(label: &'static [u8]) -> Self;
    fn squeeze(&mut self, label: &'static [u8]) -> Result<E::Scalar, NovaError>;
    fn squeeze_bits(
        &mut self,
        label: &'static [u8],
        num_bits: usize,
        start_with_one: bool,
    ) -> Result<E::Scalar, NovaError>;
    fn absorb<T: TranscriptReprTrait<E::GE>>(
        &mut self,
        label: &'static [u8],
        o: &T,
    );
    fn dom_sep(&mut self, bytes: &'static [u8]);
}
Expand description

This trait defines the behavior of a transcript engine compatible with Spartan

Required Methods§

Source

fn new(label: &'static [u8]) -> Self

initializes the transcript

Source

fn squeeze(&mut self, label: &'static [u8]) -> Result<E::Scalar, NovaError>

returns a scalar element of the group as a challenge

Source

fn squeeze_bits( &mut self, label: &'static [u8], num_bits: usize, start_with_one: bool, ) -> Result<E::Scalar, NovaError>

Returns a challenge truncated to num_bits bits.

If start_with_one is true, bit num_bits - 1 (the MSB of the truncated value) is forced to 1, so the result lies in [2^{num_bits-1}, 2^{num_bits} - 1].

num_bits must be at most E::Scalar::NUM_BITS - 1 to ensure the result is always a valid field element even after setting the MSB.

Source

fn absorb<T: TranscriptReprTrait<E::GE>>(&mut self, label: &'static [u8], o: &T)

absorbs any type that implements TranscriptReprTrait under a label

Source

fn dom_sep(&mut self, bytes: &'static [u8])

adds a domain separator

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§