Expand description
Fast random byte generation for hot key/nonce paths.
This crate ships only the hardware-only AES-256-CTR generator (derived
from the rand_aes AES-256-CTR-128 backend with software fallback state
removed): the dependency graph contains no software cipher, and OS entropy
for seeding comes from getrandom directly. Software stream ciphers used
for benchmark comparison live in the workspace’s dev-dependencies only.
§Constant-time notes
Generation never branches on, or indexes memory by, generated secret
bytes: 32-byte keys and 12-byte nonces are direct fixed-size draws with
no rejection sampling, and buffer accounting depends only on requested
lengths and cursor positions. The AES-CTR backend is constant time by
construction: it runs on hardware AES instructions with no table lookups
or data-dependent branches (see the aes_ctr module docs). Lifecycle
branches (reseed interval, fork detection) read public counters and
process state only.
Structs§
- AesCtr
KeyGenerator - Hardware-only AES-256-CTR fast random generator.
- State
Layout - Size and alignment for a reusable generator state.
Enums§
- Error
- Random generation errors.
Constants§
- AES_
CTR_ SEED_ SIZE - AES-CTR generator seed size: 32-byte AES-256 key plus 16-byte counter.
- KEY_
SIZE - AES-256 key size.
- NONCE_
SIZE - AES-GCM nonce size.
Traits§
- KeyGenerator
- Common key-generation contract for benchmarked CSPRNG backends.
Functions§
- cpu_
rng_ available - Whether a usable CPU hardware RNG is present on this guest. Reported for diagnostics/tests; the reseed path keys off the fill result, not this.