Skip to content

Commit a20120c

Browse files
authored
Remove CryptoGenerator and Generator::drop; add BlockRng::clear (#69)
1 parent f9763d8 commit a20120c

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4040
- `BlockRng::reset` method ([#44])
4141
- `BlockRng::index` method (replaced with `BlockRng::word_offset`) ([#44])
4242
- `Generator::Item` associated type ([#26])
43+
- `CryptoBlockRng` ([#69])
4344

4445
[0.10.0]: https://github.com/rust-random/rand_core/compare/v0.9.3...HEAD
4546

@@ -60,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6061
[#53]: https://github.com/rust-random/rand_core/pull/53
6162
[#56]: https://github.com/rust-random/rand_core/pull/56
6263
[#58]: https://github.com/rust-random/rand_core/pull/58
64+
[#69]: https://github.com/rust-random/rand_core/pull/69
6365

6466
[rust-random/rand]: https://github.com/rust-random/rand
6567
[rust-random/rand_core]: https://github.com/rust-random/rand_core

src/block.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//! The [`Generator`] trait and [`BlockRng`]
22
//!
3-
//! Trait [`Generator`] and marker trait [`CryptoGenerator`] may be implemented
4-
//! by block-generators; that is PRNGs whose output is a *block* of words, such
5-
//! as `[u32; 16]`.
3+
//! Trait [`Generator`] may be implemented by block-generators; that is PRNGs
4+
//! whose output is a *block* of words, such as `[u32; 16]`.
65
//!
76
//! The struct [`BlockRng`] wraps such a [`Generator`] together with an output
87
//! buffer and implements several methods (e.g. [`BlockRng::next_word`]) to
@@ -72,17 +71,8 @@
7271
//! # assert_eq!(rng.next_u32(), 1171109249);
7372
//! ```
7473
//!
75-
//! # ReseedingRng
76-
//!
77-
//! The [`Generator`] trait supports usage of [`rand::rngs::ReseedingRng`].
78-
//! This requires that [`SeedableRng`] be implemented on the "core" generator.
79-
//! Additionally, it may be useful to implement [`CryptoGenerator`].
80-
//! (This is in addition to any implementations on an [`TryRng`] type.)
81-
//!
82-
//! [`Generator`]: crate::block::Generator
8374
//! [`TryRng`]: crate::TryRng
8475
//! [`SeedableRng`]: crate::SeedableRng
85-
//! [`rand::rngs::ReseedingRng`]: https://docs.rs/rand/latest/rand/rngs/struct.ReseedingRng.html
8676
8777
use crate::utils::Word;
8878
use core::fmt;
@@ -109,18 +99,6 @@ pub trait Generator {
10999
}
110100
}
111101

112-
/// A cryptographically secure generator
113-
///
114-
/// This is a marker trait used to indicate that a [`Generator`] implementation
115-
/// is supposed to be cryptographically secure.
116-
///
117-
/// Mock generators should not implement this trait *except* under a
118-
/// `#[cfg(test)]` attribute to ensure that mock "crypto" generators cannot be
119-
/// used in production.
120-
///
121-
/// See [`TryCryptoRng`](crate::TryCryptoRng) docs for more information.
122-
pub trait CryptoGenerator: Generator {}
123-
124102
/// RNG functionality for a block [`Generator`]
125103
///
126104
/// This type encompasses a [`Generator`] [`core`](Self::core) and a buffer.

0 commit comments

Comments
 (0)