pub struct Randomizer<C: Ciphersuite>(/* private fields */);Expand description
A randomizer. A random scalar which is used to randomize the key.
Implementations§
Source§impl<C> Randomizer<C>where
C: RandomizedCiphersuite,
impl<C> Randomizer<C>where
C: RandomizedCiphersuite,
Sourcepub fn new<R: RngCore + CryptoRng>(
rng: R,
signing_package: &SigningPackage<C>,
) -> Result<Self, Error<C>>
👎Deprecated: switch to new_from_commitments(), passing the commitments from SigningPackage
pub fn new<R: RngCore + CryptoRng>( rng: R, signing_package: &SigningPackage<C>, ) -> Result<Self, Error<C>>
Create a new random Randomizer using a SigningPackage for randomness.
The SigningPackage must be the signing package being used in the
current FROST signing run. It is hashed into the randomizer calculation,
which binds it to that specific package.
Sourcepub fn new_from_commitments<R: RngCore + CryptoRng>(
rng: R,
signing_commitments: &BTreeMap<Identifier<C>, SigningCommitments<C>>,
) -> Result<(Self, Vec<u8>), Error<C>>
pub fn new_from_commitments<R: RngCore + CryptoRng>( rng: R, signing_commitments: &BTreeMap<Identifier<C>, SigningCommitments<C>>, ) -> Result<(Self, Vec<u8>), Error<C>>
Create a new random Randomizer using SigningCommitments for randomness.
The SigningCommitments map must be the one being used in the current
FROST signing run (built by the Coordinator after receiving from
Participants). It is hashed into the randomizer calculation, which binds
it to that specific commitments.
Returns the Randomizer and the generate randomizer seed. Both can be
used to regenerate the Randomizer with
Self::regenerate_from_seed_and_commitments().
Sourcepub fn regenerate_from_seed_and_commitments(
randomizer_seed: &[u8],
signing_commitments: &BTreeMap<Identifier<C>, SigningCommitments<C>>,
) -> Result<Randomizer<C>, Error<C>>where
C: RandomizedCiphersuite,
pub fn regenerate_from_seed_and_commitments(
randomizer_seed: &[u8],
signing_commitments: &BTreeMap<Identifier<C>, SigningCommitments<C>>,
) -> Result<Randomizer<C>, Error<C>>where
C: RandomizedCiphersuite,
Regenerates a Randomizer generated with
Self::new_from_commitments(). This can be used by Participants after
receiving the randomizer seed and commitments in Round 2. This is better
than the Coordinator simply generating a Randomizer and sending it to
Participants, because in this approach the participants don’t need to
fully trust the Coordinator’s random number generator (i.e. even if the
randomizer seed was not randomly generated the randomizer will still
be).
This should be used exclusively with the output of
Self::new_from_commitments(); it is strongly suggested to not
attempt generating the randomizer seed yourself (even if the point of
this approach is to hedge against issues in the randomizer seed
generation).
Source§impl<C> Randomizer<C>where
C: Ciphersuite,
impl<C> Randomizer<C>where
C: Ciphersuite,
Sourcepub fn from_scalar(scalar: Scalar<C>) -> Self
pub fn from_scalar(scalar: Scalar<C>) -> Self
Create a new Randomizer from the given scalar. It MUST be randomly generated.
It is not recommended to use this method unless for compatibility
reasons with specifications on how the randomizer must be generated. Use
Randomizer::new() instead.
Sourcepub fn deserialize(buf: &[u8]) -> Result<Self, Error<C>>
pub fn deserialize(buf: &[u8]) -> Result<Self, Error<C>>
Deserialize an Identifier from a serialized buffer. Returns an error if it attempts to deserialize zero.
Trait Implementations§
Source§impl<C: Clone + Ciphersuite> Clone for Randomizer<C>
impl<C: Clone + Ciphersuite> Clone for Randomizer<C>
Source§fn clone(&self) -> Randomizer<C>
fn clone(&self) -> Randomizer<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more