Struct schnorrkel::context::XoFTranscript

source ·
pub struct XoFTranscript<H>(/* private fields */)
where
    H: Update + ExtendableOutput + Clone;
Expand description

Very simple transcript construction from a modern hash function.

We provide this transcript type to directly use conventional hash functions with an extensible output mode, like Shake128 and Blake2x.

We recommend using merlin::Transcript instead because merlin provides the transcript abstraction natively and might function better in low memory environments. We therefore do not provide conveniences like signing_context for this.

We note that merlin already uses Keccak, upon which Shake128 is based, and that no rust implementation for Blake2x currently exists.

We caution that our transcript abstractions cannot provide the protections against hash collisions that Ed25519 provides via double hashing, but that prehashed Ed25519 variants lose. As such, any hash function used here must be collision resistant. We strongly recommend against building XOFs from weaker hash functions like SHA1 with HKDF constructions or similar.

In XoFTranscript style, we never expose the hash function H underlying this type, so that developers cannot circumvent the domain separation provided by our methods. We do this to make &mut XoFTranscript : SigningTranscript safe.

Implementations§

source§

impl<H> XoFTranscript<H>

source

pub fn new(h: H) -> XoFTranscript<H>

Create a XoFTranscript from a conventional hash functions with an extensible output mode.

We intentionally consume and never reexpose the hash function provided, so that our domain separation works correctly even when using &mut XoFTranscript : SigningTranscript.

Trait Implementations§

source§

impl<H> From<H> for XoFTranscript<H>

source§

fn from(h: H) -> XoFTranscript<H>

Converts to this type from the input type.
source§

impl<H> SigningTranscript for XoFTranscript<H>

source§

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

Extend transcript with some bytes, shadowed by merlin::Transcript.
source§

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

Produce some challenge bytes, shadowed by merlin::Transcript.
source§

fn witness_bytes_rng<R>( &self, label: &'static [u8], dest: &mut [u8], nonce_seeds: &[&[u8]], rng: R, )
where R: RngCore + CryptoRng,

Produce secret witness bytes from the protocol transcript and any “nonce seeds” kept with the secret keys.
source§

fn proto_name(&mut self, label: &'static [u8])

Extend transcript with a protocol name
source§

fn commit_point( &mut self, label: &'static [u8], compressed: &CompressedRistretto, )

Extend the transcript with a compressed Ristretto point
source§

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

Produce the public challenge scalar e.
source§

fn witness_scalar(&self, label: &'static [u8], nonce_seeds: &[&[u8]]) -> Scalar

Produce a secret witness scalar k, aka nonce, from the protocol transcript and any “nonce seeds” kept with the secret keys.
source§

fn witness_bytes( &self, label: &'static [u8], dest: &mut [u8], nonce_seeds: &[&[u8]], )

Produce secret witness bytes from the protocol transcript and any “nonce seeds” kept with the secret keys.

Auto Trait Implementations§

§

impl<H> Freeze for XoFTranscript<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for XoFTranscript<H>
where H: RefUnwindSafe,

§

impl<H> Send for XoFTranscript<H>
where H: Send,

§

impl<H> Sync for XoFTranscript<H>
where H: Sync,

§

impl<H> Unpin for XoFTranscript<H>
where H: Unpin,

§

impl<H> UnwindSafe for XoFTranscript<H>
where H: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> VRFSigningTranscript for T

§

type T = T

Real underlying SigningTranscript
source§

fn transcript_with_malleability_addressed(self, publickey: &PublicKey) -> T

Return the underlying SigningTranscript after addressing VRF output malleability, usually by making it non-malleable,
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V