Skip to content

Commit b2f19d3

Browse files
authored
Merge pull request #323 from pitdicker/additional_crypto_rng
Implement CryptoRng for EntropyRng and StdRng
2 parents 4acef1b + 0497d30 commit b2f19d3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/entropy_rng.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Entropy generator, or wrapper around external generators
1212
13-
use rand_core::{RngCore, Error, impls};
13+
use rand_core::{RngCore, CryptoRng, Error, impls};
1414
use {OsRng, JitterRng};
1515

1616
/// An RNG provided specifically for seeding PRNGs.
@@ -140,6 +140,8 @@ impl RngCore for EntropyRng {
140140
}
141141
}
142142

143+
impl CryptoRng for EntropyRng {}
144+
143145
#[cfg(test)]
144146
mod test {
145147
use super::*;

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ extern crate rand_core;
270270
use core::{marker, mem, slice};
271271

272272
// re-exports from rand-core
273-
pub use rand_core::{RngCore, CryptoRng, SeedableRng};
273+
pub use rand_core::{RngCore, BlockRngCore, CryptoRng, SeedableRng};
274274
pub use rand_core::{ErrorKind, Error};
275275

276276
// external rngs
@@ -865,6 +865,8 @@ impl SeedableRng for StdRng {
865865
}
866866
}
867867

868+
impl CryptoRng for StdRng {}
869+
868870
/// An RNG recommended when small state, cheap initialization and good
869871
/// performance are required. The PRNG algorithm in `SmallRng` is chosen to be
870872
/// efficient on the current platform, **without consideration for cryptography

0 commit comments

Comments
 (0)