-
-
Notifications
You must be signed in to change notification settings - Fork 1
Reduce block code #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Rand compatibility: rust-random/rand#1690 |
|
List of changes:
Questions:
|
newpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I wrote before, I don't think we need the Generator trait. I also really don't like the manual wrapping of BlockRng in implementation crates. It just results in a bunch of annoying boilerplate. Additionally, it's not clear how you intend to allow serialization/deserialization for Generator-based RNGs.
Finally, the separate index field is redundant and only results in bloating structure size of buffered RNGs.
CHANGELOG.mdentrySummary
This is just a cut-down version of the
blockcode: we don't need most of it.Motivation
I think this hits most of your goals outside of
le/utils, @newpavlov? No rewrite required.Details
We don't need
BlockRng64, so long as we're okay with abandoning the half-sample code (next_u32). I think that's fine.We don't need to implement
RngCore/CryptoRngonBlockRngeither.It turns out that we do need to keep
CryptoGeneratorif we want to allowReseedingRngto implementCryptoRngin a generic fashion. I suppose otherwise we could implementCryptoRngonly onThreadRng(which we already do).We also need to implement
SeedableRngon the core, otherwiseReseedingRngdoesn't work.Unsolved here:
fill_bytesis generic overW: Observablewhich is a private trait (essentially @newpavlov'sWordtrait with less features). So I think it's either that trait orfill_bytes_from_u32andfill_bytes_from_u64which isn't exactly neat design.