Transcript

Trait Transcript 

Source
pub trait Transcript: Clone {
    type Rng: CryptoRngCore;

    // Required methods
    fn new(protocol_info: &'static ProtocolInfo, session_id: &SessionId) -> Self;
    fn append_with<S: AsRef<[u8]>>(&mut self, label: &'static [u8], message: &S);
    fn append_many_with<S: AsRef<[u8]>>(
        &mut self,
        label: &'static [u8],
        messages: &[S],
    );
    fn extract(&mut self, label: &'static [u8]) -> Seed;
    fn derive_rng(&mut self, label: &'static [u8]) -> Self::Rng;
}
Expand description

A trait for succinct transcripts (via some form of hashing) used in cryptographic protocols. The transcript should be able to:

  • Absorb messages with associated labels.
  • Produce pseudorandom outputs (e.g., via a CSPRNG) based on the absorbed messages.
  • Ensure that the order and content of messages affect the outputs, providing domain separation.

Required Associated Types§

Source

type Rng: CryptoRngCore

The type of the RNG derived from the transcript.

Required Methods§

Source

fn new(protocol_info: &'static ProtocolInfo, session_id: &SessionId) -> Self

Create a new transcript for a specific protocol with a session ID for domain separation.

Source

fn append_with<S: AsRef<[u8]>>(&mut self, label: &'static [u8], message: &S)

Append a message with a label to the transcript.

Source

fn append_many_with<S: AsRef<[u8]>>( &mut self, label: &'static [u8], messages: &[S], )

Append multiple messages with a common label to the transcript.

Source

fn extract(&mut self, label: &'static [u8]) -> Seed

Extract pseudorandom bytes based on the transcript state. Note: two consecutive extractions must yield different outputs.

Source

fn derive_rng(&mut self, label: &'static [u8]) -> Self::Rng

Derive a CSPRNG from the transcript state with a specific label. Allows arbitrary-length output generation

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§