Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

[Cargo.toml] update rand to 0.7 (breaking change) #18

Merged
merged 3 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ dev = ["clippy"]

[dependencies]
arrayvec = "0.4"
clippy = {version = "0.0", optional = true}
rand = "0.6"
clippy = { version = "0.0", optional = true }
rand = "0.7"

[dev-dependencies]
hex-literal = "0.2"
rand_core = "0.4.2"
rand_core = "0.5.1"
6 changes: 3 additions & 3 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! # Public and secret keys

use arrayvec::ArrayVec;
use rand::Rng;
use rand::RngCore;

use super::{Secp256k1, ContextFlag};
use super::Error::{self, IncapableContext, InvalidPublicKey, InvalidSecretKey};
Expand Down Expand Up @@ -64,7 +64,7 @@ pub const MINUS_ONE_KEY: SecretKey = SecretKey([0xff, 0xff, 0xff, 0xff, 0xff, 0x
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub struct PublicKey(ffi::PublicKey);

fn random_32_bytes<R: Rng>(rng: &mut R) -> [u8; 32] {
fn random_32_bytes<R: RngCore>(rng: &mut R) -> [u8; 32] {
let mut ret = [0u8; 32];
rng.fill_bytes(&mut ret);
ret
Expand All @@ -73,7 +73,7 @@ fn random_32_bytes<R: Rng>(rng: &mut R) -> [u8; 32] {
impl SecretKey {
/// Creates a new random secret key
#[inline]
pub fn new<R: Rng>(secp: &Secp256k1, rng: &mut R) -> SecretKey {
pub fn new<R: RngCore>(secp: &Secp256k1, rng: &mut R) -> SecretKey {
let mut data = random_32_bytes(rng);
unsafe {
while ffi::secp256k1_ec_seckey_verify(secp.ctx, data.as_ptr()) == 0 {
Expand Down