From 2d731f144f1f78160aeee09c52131fa98f935f15 Mon Sep 17 00:00:00 2001 From: printfn Date: Sun, 10 Dec 2023 02:15:12 +0000 Subject: [PATCH] Replace nanorand with rand (see #251) --- Cargo.lock | 44 +++++++++++++++++++++++++++++++++++++------- cli/Cargo.toml | 2 +- cli/src/context.rs | 3 +-- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a397b2f..586b023e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -147,8 +147,8 @@ dependencies = [ "ctrlc", "fend-core", "home", - "nanorand", "native-tls", + "rand", "rustyline", "serde", "toml", @@ -291,12 +291,6 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" - [[package]] name = "native-tls" version = "0.2.11" @@ -397,6 +391,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro2" version = "1.0.70" @@ -425,6 +425,36 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "redox_syscall" version = "0.4.1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 030d0f2a..c9b4466b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -15,8 +15,8 @@ console = { version = "0.15.7", default-features = false } ctrlc = "3.4.1" fend-core.workspace = true home = "0.5.5" -nanorand = { version = "0.7.0", default-features = false, features = ["std", "wyrand"] } native-tls = { version = "0.2.11", optional = true } +rand = { version = "0.8.5", default-features = false, features = ["std", "std_rng"] } rustyline = { version = "13.0.0", default-features = false, features = ["with-file-history", "custom-bindings"] } serde = { version = "1.0.193", default-features = false } toml = { version = "0.8.8", default-features = false, features = ["parse"] } diff --git a/cli/src/context.rs b/cli/src/context.rs index cceae951..3ab02c15 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -103,6 +103,5 @@ impl<'a> Context<'a> { } fn random_u32() -> u32 { - let mut rng = nanorand::WyRand::new(); - nanorand::Rng::generate(&mut rng) + rand::random() }