Struct merlin::Transcript

source ·
pub struct Transcript { /* private fields */ }
Expand description

A transcript of a public-coin argument.

The prover’s messages are added to the transcript using append_message, and the verifier’s challenges can be computed using challenge_bytes.

Creating and using a Merlin transcript

To create a Merlin transcript, use Transcript::new(). This function takes a domain separation label which should be unique to the application.

To use the transcript with a Merlin-based proof implementation, the prover’s side creates a Merlin transcript with an application-specific domain separation label, and passes a &mut reference to the transcript to the proving function(s).

To verify the resulting proof, the verifier creates their own Merlin transcript using the same domain separation label, then passes a &mut reference to the verifier’s transcript to the verification function.

Implementing proofs using Merlin

For information on the design of Merlin and how to use it to implement a proof system, see the documentation at merlin.cool, particularly the Using Merlin section.

Implementations§

source§

impl Transcript

source

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

Initialize a new transcript with the supplied label, which is used as a domain separator.

Note

This function should be called by a proof library’s API consumer (i.e., the application using the proof library), and not by the proof implementation. See the Passing Transcripts section of the Merlin website for more details on why.

source

pub fn append_message(&mut self, label: &'static [u8], message: &[u8])

Append a prover’s message to the transcript.

The label parameter is metadata about the message, and is also appended to the transcript. See the Transcript Protocols section of the Merlin website for details on labels.

source

pub fn commit_bytes(&mut self, label: &'static [u8], message: &[u8])

👎Deprecated since 1.1.0: renamed to append_message for clarity.

Deprecated. This function was renamed to append_message.

This is intended to avoid any possible confusion between the transcript-level messages and protocol-level commitments.

source

pub fn append_u64(&mut self, label: &'static [u8], x: u64)

Convenience method for appending a u64 to the transcript.

The label parameter is metadata about the message, and is also appended to the transcript. See the Transcript Protocols section of the Merlin website for details on labels.

Implementation

Calls append_message with the 8-byte little-endian encoding of x.

source

pub fn commit_u64(&mut self, label: &'static [u8], x: u64)

👎Deprecated since 1.1.0: renamed to append_u64 for clarity.

Deprecated. This function was renamed to append_u64.

This is intended to avoid any possible confusion between the transcript-level messages and protocol-level commitments.

source

pub fn challenge_bytes(&mut self, label: &'static [u8], dest: &mut [u8])

Fill the supplied buffer with the verifier’s challenge bytes.

The label parameter is metadata about the challenge, and is also appended to the transcript. See the Transcript Protocols section of the Merlin website for details on labels.

source

pub fn build_rng(&self) -> TranscriptRngBuilder

Fork the current Transcript to construct an RNG whose output is bound to the current transcript state as well as prover’s secrets.

See the TranscriptRngBuilder documentation for more details.

Trait Implementations§

source§

impl Clone for Transcript

source§

fn clone(&self) -> Transcript

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Zeroize for Transcript

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.