[−][src]Struct secp256kfun::nonce::NonceChallengeBundle
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]
fn clone(&self) -> NonceChallengeBundle<H, NG>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<H: Debug, NG: Debug> Debug for NonceChallengeBundle<H, NG>
[src]
impl<H: Default, NG: Default> Default for NonceChallengeBundle<H, NG>
[src]
fn default() -> NonceChallengeBundle<H, NG>
[src]
Auto Trait Implementations
impl<H, NG> RefUnwindSafe for NonceChallengeBundle<H, NG> where
H: RefUnwindSafe,
NG: RefUnwindSafe,
H: RefUnwindSafe,
NG: RefUnwindSafe,
impl<H, NG> Send for NonceChallengeBundle<H, NG> where
H: Send,
NG: Send,
H: Send,
NG: Send,
impl<H, NG> Sync for NonceChallengeBundle<H, NG> where
H: Sync,
NG: Sync,
H: Sync,
NG: Sync,
impl<H, NG> Unpin for NonceChallengeBundle<H, NG> where
H: Unpin,
NG: Unpin,
H: Unpin,
NG: Unpin,
impl<H, NG> UnwindSafe for NonceChallengeBundle<H, NG> where
H: UnwindSafe,
NG: UnwindSafe,
H: UnwindSafe,
NG: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Mark for T
[src]
#[must_use]fn mark<M>(Self) -> <M as ChangeMark<T>>::Out where
M: ChangeMark<T>,
[src]
M: ChangeMark<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,