Constraint Scalar with Copy

This commit is contained in:
daxpedda
2021-07-08 18:55:53 -07:00
committed by Kevin Lewi
parent dd97a81641
commit 52d68d6f77
6 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -78,8 +78,8 @@ impl<G: Group> KeyPair<G> {
/// Generating a random key pair given a cryptographic rng
pub(crate) fn generate_random<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
let sk = G::random_nonzero_scalar(rng);
let sk_bytes = G::scalar_as_bytes(&sk);
let pk = G::base_point().mult_by_slice(sk_bytes);
let sk_bytes = G::scalar_as_bytes(sk);
let pk = G::base_point().mult_by_slice(&sk_bytes);
Self {
pk: PublicKey::new(Key(pk.to_arr().to_vec())),
sk: PrivateKey::new(Key(sk_bytes.to_vec())),