Random generation
Read random bytes from the operating system or a seeded generator.
Use oxcrypto.random.bytes for keys, nonces, and salts. Use a seeded
generator only when the same seed must reproduce the same output.
Algorithms
- Operating system CSPRNG Read random bytes from the operating system.
- ChaCha Generate reproducible bytes from a seed with ChaCha8, ChaCha12, or ChaCha20.
Zeroization
Zeroization applies only to memory that Rust owns. The chacha20 crate is
written to overwrite the generator state when it is freed, and oxcrypto
overwrites its own temporary Rust buffers. oxcrypto has not verified the
upstream behavior independently, and chacha20 has no published audit.
- Python objects are never wiped. That includes the seeds you pass in as
bytesand everybytesresult. They stay in memory until Python reuses it. - Python may copy buffers, for example when it builds or slices
bytes, so more copies than the ones you hold can exist. - Zeroization does not cover copies the operating system makes, such as swap or core dumps.