From 9a8a6eb2129e799528c345f13442149cfa0a0d56 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 28 Aug 2020 16:42:55 +0200 Subject: [PATCH] `StdRng`: Switch to `ChaCha12` Fixes #932. --- src/rngs/std.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/rngs/std.rs b/src/rngs/std.rs index 228896f9db8..a90d86f7880 100644 --- a/src/rngs/std.rs +++ b/src/rngs/std.rs @@ -11,11 +11,11 @@ use crate::{CryptoRng, Error, RngCore, SeedableRng}; #[cfg(all(any(test, feature = "std"), not(target_os = "emscripten")))] -pub(crate) use rand_chacha::ChaCha20Core as Core; +pub(crate) use rand_chacha::ChaCha12Core as Core; #[cfg(all(any(test, feature = "std"), target_os = "emscripten"))] pub(crate) use rand_hc::Hc128Core as Core; -#[cfg(not(target_os = "emscripten"))] use rand_chacha::ChaCha20Rng as Rng; +#[cfg(not(target_os = "emscripten"))] use rand_chacha::ChaCha12Rng as Rng; #[cfg(target_os = "emscripten")] use rand_hc::Hc128Rng as Rng; /// The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient @@ -88,9 +88,6 @@ mod test { let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - #[cfg(any(feature = "stdrng_strong", not(feature = "stdrng_fast")))] - let target = [3950704604716924505, 5573172343717151650]; - #[cfg(all(not(feature = "stdrng_strong"), feature = "stdrng_fast"))] let target = [10719222850664546238, 14064965282130556830]; let mut rng0 = StdRng::from_seed(seed);