Skip to content

ChaCha construction and rounds #349

@dhardy

Description

@dhardy

This is about two things; set_rounds and a new constructor; quotes from reddit:

The methods new_unseeded and set_rounds on the ChaChaRng type are a bit scary, IMHO. I'm heartened that the former is deprecated, but maybe the warning ought to be strengthened (e.g., "This method makes it too easy to create a random number generator in an insecure state.") set_rounds sounds like something that should only be allowed when the object is being created. More generally, I just noticed that there's no "raw" method for creating a ChaChaRng from a key and nonce/counter—I think there ought to be one.

set_counter is also a bit scary but something like it is most likely necessary to support non-cryptographic applications (e.g., producing multiple random streams from the same seed by advancing far into the generator's sequence).

I wonder if we should support CryptoRng only for ChaCha20 and maybe ChaCha12?

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-APIBreakage: APIF-new-intFunctionality: new, within RandP-highPriority: high

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions