[−][src]Trait schnorr_fun::nonce::NonceGen
A trait for hash based nonce gneration.
A NonceGen
is a type that can repeatadly be asked to inititalize a hash
state with begin_derivation
that appear random for anyone who doesn't
know the secret
.
There are two main implementations of this trait:
Deterministic
: just adds the secret to the hash and returns it.Synthetic
: adds randomness into the secret before hashing it.
In general it's better to use the [derive_nonce
] macro than to call
begin_derivation
directly.
Associated Types
type Hash: Digest
The type of hash that begin_derivation
will return.
Required methods
fn begin_derivation(&self, secret: &Scalar<Secret, NonZero>) -> Self::Hash
Takes a secret Scalar
and outputs a hash. Before turining this hash
into the nonce, you must add all the public inputs from the scheme into
the hash. So for a signature scheme for example you would add the
message and the public key.
Implementors
impl<H> NonceGen for Deterministic<H> where
H: Tagged + Clone + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>,
[src]
H: Tagged + Clone + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>,
type Hash = H
fn begin_derivation(
&self,
secret: &Scalar<Secret, NonZero>
) -> <Deterministic<H> as NonceGen>::Hash
[src]
&self,
secret: &Scalar<Secret, NonZero>
) -> <Deterministic<H> as NonceGen>::Hash
impl<H, R> NonceGen for Synthetic<H, R> where
H: Tagged + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + Clone,
R: NonceRng,
[src]
H: Tagged + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + Clone,
R: NonceRng,