mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-11-15 18:47:01 +00:00
Migrate remaining crates to rand_core 0.4
This commit is contained in:
@@ -22,7 +22,8 @@ libc = "0.2"
|
||||
pairing = { path = "../pairing" }
|
||||
lazy_static = "1"
|
||||
byteorder = "1"
|
||||
rand = "0.5"
|
||||
rand_core = "0.4"
|
||||
rand_os = "0.1"
|
||||
sapling-crypto = { path = "../sapling-crypto" }
|
||||
zcash_primitives = { path = "../zcash_primitives" }
|
||||
zcash_proofs = { path = "../zcash_proofs" }
|
||||
|
||||
@@ -5,7 +5,8 @@ extern crate byteorder;
|
||||
extern crate ff;
|
||||
extern crate libc;
|
||||
extern crate pairing;
|
||||
extern crate rand;
|
||||
extern crate rand_core;
|
||||
extern crate rand_os;
|
||||
extern crate sapling_crypto;
|
||||
extern crate zcash_primitives;
|
||||
extern crate zcash_proofs;
|
||||
@@ -37,7 +38,8 @@ use blake2s_simd::Params as Blake2sParams;
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||
|
||||
use rand::{OsRng, Rng};
|
||||
use rand_core::RngCore;
|
||||
use rand_os::OsRng;
|
||||
use std::io::BufReader;
|
||||
|
||||
use libc::{c_char, c_uchar, int64_t, size_t, uint32_t, uint64_t};
|
||||
@@ -388,9 +390,7 @@ pub extern "system" fn librustzcash_sapling_generate_r(result: *mut [c_uchar; 32
|
||||
// create random 64 byte buffer
|
||||
let mut rng = OsRng::new().expect("should be able to construct RNG");
|
||||
let mut buffer = [0u8; 64];
|
||||
for i in 0..buffer.len() {
|
||||
buffer[i] = rng.gen();
|
||||
}
|
||||
rng.fill_bytes(&mut buffer);
|
||||
|
||||
// reduce to uniform value
|
||||
let r = <Bls12 as JubjubEngine>::Fs::to_uniform(&buffer[..]);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use ff::{PrimeField, PrimeFieldRepr};
|
||||
use pairing::bls12_381::Bls12;
|
||||
use rand::{OsRng, Rng};
|
||||
use rand_core::RngCore;
|
||||
use rand_os::OsRng;
|
||||
use sapling_crypto::jubjub::{edwards, JubjubBls12};
|
||||
use sapling_crypto::primitives::{Diversifier, ViewingKey};
|
||||
|
||||
@@ -22,7 +23,9 @@ fn test_key_agreement() {
|
||||
|
||||
// Create a random address with the viewing key
|
||||
let addr = loop {
|
||||
match vk.into_payment_address(Diversifier(rng.gen()), ¶ms) {
|
||||
let mut d = [0; 11];
|
||||
rng.fill_bytes(&mut d);
|
||||
match vk.into_payment_address(Diversifier(d), ¶ms) {
|
||||
Some(a) => break a,
|
||||
None => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user