rust-random / book

The Rust Rand Book
Other
49 stars 19 forks source link

confusing lack of full name for StdRng on guide-rngs.html #58

Open Artoria2e5 opened 5 months ago

Artoria2e5 commented 5 months ago

The table in https://rust-random.github.io/book/guide-rngs.html#cryptographically-secure-pseudo-random-number-generators-csprngs lists StdRng with known properties for "performance", "initialization", "memory", "security (predictability)", "forward secrecy", but notably does NOT give its full name: ChaCha12. This is confusing.

Like, what are we trying to do here? If we don't want to tie the choice of RNG down to ChaCha12, we would have no definite answers for "performance", "initialization", "memory", etc. either. If we have definite answers for these columns, it naturally follows that we definitely know what generator it is using.

While we're at it, it's a little fishy that ChaCha12 is running slower than ChaCha20. Is this a fluke in the benchmark, outdated table, or some real performance issue?

dhardy commented 5 months ago

ChaCha12 should be faster... those benchmarks probably are a little fishy.

We previously used ChaCha20 (and before that HC-128, and before that Isaac RNG), so we have changed the generator while roughly retaining those properties — except for improving memory usage and init speed.

Also, there are unresolved questions (#57) and the book probably does have some flaws.