Align Ristretto255::random_scalar() with spec (#142)

This commit is contained in:
daxpedda
2025-05-07 15:40:24 -07:00
committed by GitHub
parent 23aa7813e7
commit f3f4fef0e9
+3 -2
View File
@@ -96,9 +96,10 @@ impl Group for Ristretto255 {
fn random_scalar<R: RngCore + CryptoRng>(rng: &mut R) -> Self::Scalar {
loop {
let scalar = Scalar::random(rng);
let mut scalar_bytes = [0u8; 32];
rng.fill_bytes(&mut scalar_bytes);
if scalar != Scalar::ZERO {
if let Ok(scalar) = Self::deserialize_scalar(&scalar_bytes) {
break scalar;
}
}