rust-random / rust-random/rand_core

Future of `block` module

Open
#71 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
14
Forks
9
PR merge metrics
No merged PRs in 30d

Description

The block module is designed to assist implementing Rng for a block-generator. #31 (and the linked PRs) brought up a number of issues with prior designs, some of which have been solved. Some remaining issues:

  • The internal buffer prevents RNGs from simply deriving serde (or other serialization) support; methods have been added to make this possible but they are often harder to use.
  • Fn Generator::drop exists to provide compatibility with zeroize; while functional the design is inelegant.
  • There is a significant amount of code for few downstream use-cases.

To the latter point: the block module is currently used by the following crates:

  • chacha20
  • rand_chacha
  • rand_hc
  • rand_isaac

All of these have at some point been used to provide rand::rngs::StdRng. The latter two already have very few downloads on crates.io for the latest versions, indicating few (if any) direct users. chacha20 is value-compatible with rand_chacha. It may therefore be viable to deprecate all three of the latter crates.

It may therefore make sense to move the block code into chacha20 (and any other block RNG impl which doesn't get deprecated), possibly with one more addition to rand_core::utils to cover the fill_bytes implementation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading this issue together with #31 and its linked pull requests, then inspect the block module and its uses in chacha20, rand_chacha, rand_hc, and rand_isaac. Done means producing and agreeing on a concrete direction for the module, including which crates remain supported or are deprecated and how serialization and zeroization concerns are handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.