diff --git a/Cargo.lock b/Cargo.lock index d4ade10..4dd7851 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,7 +368,6 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "pairing 0.14.2", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "zcash_primitives 0.0.0", "zcash_proofs 0.0.0", ] @@ -513,15 +512,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_os" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_xorshift" version = "0.2.0" @@ -640,7 +630,6 @@ dependencies = [ "pairing 0.14.2", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -656,7 +645,6 @@ dependencies = [ "ff 0.4.0", "pairing 0.14.2", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "zcash_primitives 0.0.0", ] @@ -717,7 +705,6 @@ dependencies = [ "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a788ae3edb696cfcba1c19bfd388cc4b8c21f8a408432b199c072825084da58a" "checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" diff --git a/librustzcash/Cargo.toml b/librustzcash/Cargo.toml index becdf2a..a44d3b5 100644 --- a/librustzcash/Cargo.toml +++ b/librustzcash/Cargo.toml @@ -25,6 +25,5 @@ pairing = { path = "../pairing" } lazy_static = "1" byteorder = "1" rand_core = "0.5" -rand_os = "0.2" zcash_primitives = { path = "../zcash_primitives" } zcash_proofs = { path = "../zcash_proofs" } diff --git a/librustzcash/src/rustzcash.rs b/librustzcash/src/rustzcash.rs index 068b824..fc8d3ef 100644 --- a/librustzcash/src/rustzcash.rs +++ b/librustzcash/src/rustzcash.rs @@ -27,8 +27,7 @@ use blake2s_simd::Params as Blake2sParams; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use std::io::BufReader; use libc::{c_char, c_uchar, size_t}; diff --git a/librustzcash/src/tests/key_agreement.rs b/librustzcash/src/tests/key_agreement.rs index 1250cc7..c4f56a1 100644 --- a/librustzcash/src/tests/key_agreement.rs +++ b/librustzcash/src/tests/key_agreement.rs @@ -1,7 +1,6 @@ use ff::{PrimeField, PrimeFieldRepr}; use pairing::bls12_381::Bls12; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use zcash_primitives::jubjub::{edwards, JubjubBls12}; use zcash_primitives::primitives::{Diversifier, ViewingKey}; diff --git a/zcash_primitives/Cargo.toml b/zcash_primitives/Cargo.toml index a026618..2becbc4 100644 --- a/zcash_primitives/Cargo.toml +++ b/zcash_primitives/Cargo.toml @@ -21,7 +21,6 @@ log = "0.4" pairing = { path = "../pairing" } rand = "0.7" rand_core = "0.5" -rand_os = "0.2" sha2 = "0.8" [dev-dependencies] diff --git a/zcash_primitives/benches/pedersen_hash.rs b/zcash_primitives/benches/pedersen_hash.rs index b647740..3ea652a 100644 --- a/zcash_primitives/benches/pedersen_hash.rs +++ b/zcash_primitives/benches/pedersen_hash.rs @@ -2,13 +2,11 @@ extern crate pairing; extern crate rand_core; -extern crate rand_os; extern crate test; extern crate zcash_primitives; use pairing::bls12_381::Bls12; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use zcash_primitives::jubjub::JubjubBls12; use zcash_primitives::pedersen_hash::{pedersen_hash, Personalization}; diff --git a/zcash_primitives/src/merkle_tree.rs b/zcash_primitives/src/merkle_tree.rs index 2721ab6..b8abf11 100644 --- a/zcash_primitives/src/merkle_tree.rs +++ b/zcash_primitives/src/merkle_tree.rs @@ -202,18 +202,19 @@ impl CommitmentTree { /// ``` /// extern crate ff; /// extern crate pairing; -/// extern crate rand_os; +/// extern crate rand_core; /// extern crate zcash_primitives; /// /// use ff::{Field, PrimeField}; /// use pairing::bls12_381::Fr; -/// use rand_os::OsRng; +/// use rand_core::OsRng; /// use zcash_primitives::{ /// merkle_tree::{CommitmentTree, IncrementalWitness}, /// sapling::Node, /// }; /// -/// let mut rng = OsRng::new().unwrap(); +/// let mut rng = OsRng; +/// /// let mut tree = CommitmentTree::::new(); /// /// tree.append(Node::new(Fr::random(&mut rng).into_repr())); diff --git a/zcash_primitives/src/note_encryption.rs b/zcash_primitives/src/note_encryption.rs index e728c5e..747bd8d 100644 --- a/zcash_primitives/src/note_encryption.rs +++ b/zcash_primitives/src/note_encryption.rs @@ -214,12 +214,12 @@ fn prf_ock( /// ``` /// extern crate ff; /// extern crate pairing; -/// extern crate rand_os; +/// extern crate rand_core; /// extern crate zcash_primitives; /// /// use ff::Field; /// use pairing::bls12_381::Bls12; -/// use rand_os::OsRng; +/// use rand_core::OsRng; /// use zcash_primitives::{ /// jubjub::fs::Fs, /// keys::OutgoingViewingKey, @@ -556,8 +556,8 @@ mod tests { use crypto_api_chachapoly::ChachaPolyIetf; use ff::{Field, PrimeField, PrimeFieldRepr}; use pairing::bls12_381::{Bls12, Fr, FrRepr}; + use rand_core::OsRng; use rand_core::{CryptoRng, RngCore}; - use rand_os::OsRng; use std::str::FromStr; use super::{ diff --git a/zcash_primitives/src/prover.rs b/zcash_primitives/src/prover.rs index 7c66737..d071816 100644 --- a/zcash_primitives/src/prover.rs +++ b/zcash_primitives/src/prover.rs @@ -74,7 +74,7 @@ pub trait TxProver { pub(crate) mod mock { use ff::Field; use pairing::bls12_381::{Bls12, Fr}; - use rand_os::OsRng; + use rand_core::OsRng; use crate::{ jubjub::{edwards, fs::Fs, FixedGenerators, Unknown}, diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index b100d9c..645a6cb 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -534,7 +534,7 @@ impl Builder { #[cfg(test)] mod tests { use ff::{Field, PrimeField}; - use rand::rngs::OsRng; + use rand_core::OsRng; use crate::jubjub::fs::Fs; diff --git a/zcash_primitives/src/transaction/tests.rs b/zcash_primitives/src/transaction/tests.rs index d772944..99c7a95 100644 --- a/zcash_primitives/src/transaction/tests.rs +++ b/zcash_primitives/src/transaction/tests.rs @@ -1,6 +1,6 @@ use ff::Field; use pairing::bls12_381::Bls12; -use rand_os::OsRng; +use rand_core::OsRng; use crate::jubjub::{fs::Fs, FixedGenerators}; diff --git a/zcash_proofs/Cargo.toml b/zcash_proofs/Cargo.toml index f47714d..6dab0d1 100644 --- a/zcash_proofs/Cargo.toml +++ b/zcash_proofs/Cargo.toml @@ -14,11 +14,10 @@ byteorder = "1" directories = { version = "1", optional = true } ff = { path = "../ff" } pairing = { path = "../pairing" } -rand_os = "0.2" +rand_core = "0.5" zcash_primitives = { path = "../zcash_primitives" } [dev-dependencies] -rand_core = "0.5" rand_xorshift = "0.2" [features] diff --git a/zcash_proofs/src/sapling/prover.rs b/zcash_proofs/src/sapling/prover.rs index 9b0f871..70b529a 100644 --- a/zcash_proofs/src/sapling/prover.rs +++ b/zcash_proofs/src/sapling/prover.rs @@ -4,7 +4,7 @@ use bellman::{ }; use ff::Field; use pairing::bls12_381::{Bls12, Fr}; -use rand_os::OsRng; +use rand_core::OsRng; use zcash_primitives::{ jubjub::{edwards, fs::Fs, FixedGenerators, JubjubBls12, Unknown}, primitives::{Diversifier, Note, PaymentAddress, ProofGenerationKey, ValueCommitment},