mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-08 21:00:40 +00:00
Change docstring to match the trait bound
This commit is contained in:
parent
6ea1d4dad2
commit
91e11b6318
1 changed files with 4 additions and 6 deletions
|
|
@ -144,21 +144,19 @@ impl CTAssignable for Scalar {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scalar {
|
impl Scalar {
|
||||||
/// Return a `Scalar` chosen uniformly at random using a CSPRNG.
|
/// Return a `Scalar` chosen uniformly at random using a user-provided RNG.
|
||||||
/// Panics if the operating system's CSPRNG is unavailable.
|
|
||||||
///
|
///
|
||||||
/// # Inputs
|
/// # Inputs
|
||||||
///
|
///
|
||||||
/// * `cspring`: any cryptographically secure PRNG which
|
/// * `rng`: any RNG which implements the `rand::Rng` interface.
|
||||||
/// implements the `rand::Rng` interface.
|
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
///
|
///
|
||||||
/// A random scalar within ℤ/lℤ.
|
/// A random scalar within ℤ/lℤ.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub fn random<T: Rng>(csprng: &mut T) -> Self {
|
pub fn random<T: Rng>(rng: &mut T) -> Self {
|
||||||
let mut scalar_bytes = [0u8; 64];
|
let mut scalar_bytes = [0u8; 64];
|
||||||
csprng.fill_bytes(&mut scalar_bytes);
|
rng.fill_bytes(&mut scalar_bytes);
|
||||||
Scalar::reduce(&scalar_bytes)
|
Scalar::reduce(&scalar_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue