1414
1515//! Non-physical true random number generator based on timing jitter.
1616//!
17+ //! Note that this RNG is not suited for use cases where cryptographic security is
18+ //! required (also see this [discussion]).
19+ //!
1720//! This is a true random number generator, as opposed to pseudo-random
1821//! generators. Random numbers generated by `JitterRng` can be seen as fresh
1922//! entropy. A consequence is that it is orders of magnitude slower than `OsRng`
2427//! indistinguishable, and a cryptographic PRNG should also be as impossible to
2528//! predict.
2629//!
27- //! Use of `JitterRng` is recommended for initializing cryptographic PRNGs when
28- //! `OsRng` is not available.
29- //!
3030//! `JitterRng` can be used without the standard library, but not conveniently,
3131//! you must provide a high-precision timer and carefully have to follow the
3232//! instructions of [`JitterRng::new_with_timer`].
3939//! with disabled `std` feature.
4040//!
4141//! [Jitterentropy]: http://www.chronox.de/jent.html
42+ //! [discussion]: https://github.com/rust-random/rand/issues/699
4243
4344#![ doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" ,
4445 html_favicon_url = "https://www.rust-lang.org/favicon.ico" ,
@@ -81,7 +82,7 @@ doc_comment!(include_str!("../README.md"));
8182mod platform;
8283mod error;
8384
84- use rand_core:: { RngCore , CryptoRng , Error , impls} ;
85+ use rand_core:: { RngCore , Error , impls} ;
8586pub use error:: TimerError ;
8687
8788use core:: { fmt, mem, ptr} ;
@@ -97,6 +98,9 @@ const MEMORY_SIZE: usize = MEMORY_BLOCKS * MEMORY_BLOCKSIZE;
9798
9899/// A true random number generator based on jitter in the CPU execution time,
99100/// and jitter in memory access time.
101+ ///
102+ /// Note that this RNG is not suitable for use cases where cryptographic
103+ /// security is required.
100104pub struct JitterRng {
101105 data : u64 , // Actual random number
102106 // Number of rounds to run the entropy collector per 64 bits
@@ -724,6 +728,3 @@ impl RngCore for JitterRng {
724728 Ok ( self . fill_bytes ( dest) )
725729 }
726730}
727-
728- impl CryptoRng for JitterRng { }
729-
0 commit comments