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 extract_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§
Sourcetype Rng: CryptoRngCore
type Rng: CryptoRngCore
The type of the RNG derived from the transcript.
Required Methods§
Sourcefn new(protocol_info: &'static ProtocolInfo, session_id: &SessionId) -> Self
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.
Sourcefn append_with<S: AsRef<[u8]>>(&mut self, label: &'static [u8], message: &S)
fn append_with<S: AsRef<[u8]>>(&mut self, label: &'static [u8], message: &S)
Append a message with a label to the transcript.
Sourcefn append_many_with<S: AsRef<[u8]>>(
&mut self,
label: &'static [u8],
messages: &[S],
)
fn append_many_with<S: AsRef<[u8]>>( &mut self, label: &'static [u8], messages: &[S], )
Append multiple messages with a common label to the transcript.
Sourcefn extract(&mut self, label: &'static [u8]) -> Seed
fn extract(&mut self, label: &'static [u8]) -> Seed
Extract pseudorandom bytes based on the transcript state. Note: two consecutive extractions must yield different outputs.
Sourcefn extract_rng(&mut self, label: &'static [u8]) -> Self::Rng
fn extract_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.