Module rng

Source
Expand description

Random number generation.

For most purposes in Arti, we use one of two random number generators:

  • rand::rng() (formerly called rand::thread_rng(), up till rand 0.9)
  • The CautiousRng implemented here.

CautiousRng should be used whenever we are generating a medium- or long-term cryptographic key: one that will be stored to disk, or used for more than a single communication. It is slower than rand::rng(), but is more robust against several kinds of failure.

Modules§

backup 🔒 Non-WebAssembly
A backup RNG, independent of other known sources.
testing 🔒 testing
Functionality for testing Rng code that requires an EntropicRng.

Structs§

CautiousRng
An exceptionally cautious wrapper for rand_core::OsRng
FakeEntropicRngrpc
Testing only: Pretend that an inner RNG truly implements EntropicRng.

Traits§

EntropicRng
Trait representing an Rng where every output is derived from supposedly strong entropy.