Skip to main content

Module chacha

Module chacha 

Source
Expand description

ChaCha20 CSPRNG (feature crypto). ChaCha20-based CSPRNG backend (feature crypto).

Thin wrapper around rand_chacha::ChaCha20Rng - the rand-ecosystem reference implementation, audited via its upstream maintainers. vrd does not roll its own crypto.

ChaCha20 is a stream cipher with a 256-bit key and an 2⁶⁴-block period (sufficient for any single application). It’s the standard CSPRNG for security-adjacent random output: session tokens, salts, UUIDs that need unpredictability.

§CSPRNG contract

Given an unpredictable seed (e.g. Random::new_secure’s OS entropy), the output stream is computationally indistinguishable from true random bytes to any polynomial-time observer that does not see the seed.

Structs§

ChaChaRng
ChaCha20-based CSPRNG state. Wraps rand_chacha::ChaCha20Rng and exposes the same TryRng / SeedableRng surface as the other vrd backends.