[][src]Struct secp256kfun::nonce::NonceChallengeBundle

pub struct NonceChallengeBundle<H, NG> {
    pub challenge_hash: H,
    pub nonce_gen: NG,
}

A struct to keep tagging of a Fiat-Shamir challenge hash and a NonceGen in sync.

This exists because changing the challenge hash without changing nonce generation can be a catastrophic mistake. Any time you are doing the Fiat-Shamir transform you should use this. Internally this follows the structure of BIP-340 for protocol tagging so if you do:

use rand::rngs::ThreadRng;
use secp256kfun::{
    hash::AddTag,
    nonce::{GlobalRng, NonceChallengeBundle, Synthetic},
};
use sha2::Sha256;
let nonce_gen = Synthetic::<Sha256, GlobalRng<ThreadRng>>::default();
let fs = NonceChallengeBundle {
    challenge_hash: Sha256::default(),
    nonce_gen,
}
.add_protocol_tag("BIP340");

You get a perfectly compliant BIP-340 challenge and nonce state.

Fields

challenge_hash: H

The challenge hash for the Fiat-Shamir based scheme.

nonce_gen: NG

The nonce genertor for the Firat-Shamir based scheme.

Trait Implementations

impl<H: Tagged, NG: AddTag> AddTag for NonceChallengeBundle<H, NG>[src]

fn add_protocol_tag(self, tag: &str) -> Self[src]

Tags both the NonceGen and the challenge hash with a protocol specific tag.

fn add_application_tag(self, tag: &str) -> Self[src]

Tags both the NonceGen and the challenge hash with an application specific tag.

impl<H: Clone, NG: Clone> Clone for NonceChallengeBundle<H, NG>[src]

impl<H: Debug, NG: Debug> Debug for NonceChallengeBundle<H, NG>[src]

impl<H: Default, NG: Default> Default for NonceChallengeBundle<H, NG>[src]

Auto Trait Implementations

impl<H, NG> RefUnwindSafe for NonceChallengeBundle<H, NG> where
    H: RefUnwindSafe,
    NG: RefUnwindSafe

impl<H, NG> Send for NonceChallengeBundle<H, NG> where
    H: Send,
    NG: Send

impl<H, NG> Sync for NonceChallengeBundle<H, NG> where
    H: Sync,
    NG: Sync

impl<H, NG> Unpin for NonceChallengeBundle<H, NG> where
    H: Unpin,
    NG: Unpin

impl<H, NG> UnwindSafe for NonceChallengeBundle<H, NG> where
    H: UnwindSafe,
    NG: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Mark for T[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.