14
14
15
15
//! Non-physical true random number generator based on timing jitter.
16
16
//!
17
+ //! Note that this RNG is not suited for use cases where cryptographic security is
18
+ //! required (also see this [discussion]).
19
+ //!
17
20
//! This is a true random number generator, as opposed to pseudo-random
18
21
//! generators. Random numbers generated by `JitterRng` can be seen as fresh
19
22
//! entropy. A consequence is that it is orders of magnitude slower than `OsRng`
24
27
//! indistinguishable, and a cryptographic PRNG should also be as impossible to
25
28
//! predict.
26
29
//!
27
- //! Use of `JitterRng` is recommended for initializing cryptographic PRNGs when
28
- //! `OsRng` is not available.
29
- //!
30
30
//! `JitterRng` can be used without the standard library, but not conveniently,
31
31
//! you must provide a high-precision timer and carefully have to follow the
32
32
//! instructions of [`JitterRng::new_with_timer`].
39
39
//! with disabled `std` feature.
40
40
//!
41
41
//! [Jitterentropy]: http://www.chronox.de/jent.html
42
+ //! [discussion]: https://github.com/rust-random/rand/issues/699
42
43
43
44
#![ doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" ,
44
45
html_favicon_url = "https://www.rust-lang.org/favicon.ico" ,
@@ -81,7 +82,7 @@ doc_comment!(include_str!("../README.md"));
81
82
mod platform;
82
83
mod error;
83
84
84
- use rand_core:: { RngCore , CryptoRng , Error , impls} ;
85
+ use rand_core:: { RngCore , Error , impls} ;
85
86
pub use error:: TimerError ;
86
87
87
88
use core:: { fmt, mem, ptr} ;
@@ -97,6 +98,9 @@ const MEMORY_SIZE: usize = MEMORY_BLOCKS * MEMORY_BLOCKSIZE;
97
98
98
99
/// A true random number generator based on jitter in the CPU execution time,
99
100
/// and jitter in memory access time.
101
+ ///
102
+ /// Note that this RNG is not suitable for use cases where cryptographic
103
+ /// security is required.
100
104
pub struct JitterRng {
101
105
data : u64 , // Actual random number
102
106
// Number of rounds to run the entropy collector per 64 bits
@@ -724,6 +728,3 @@ impl RngCore for JitterRng {
724
728
Ok ( self . fill_bytes ( dest) )
725
729
}
726
730
}
727
-
728
- impl CryptoRng for JitterRng { }
729
-
0 commit comments