The ChaCha family of stream ciphers

Features

Supported Variants

ChaCha20: used in chacha20-poly1305 in TLS, OpenSSH; arc4random in the BSDs, Linux /dev/urandom since 4.8.

Ietf: IETF RFC 7539. Longer nonce, short block counter.

XChaCha20: constructed analogously to XSalsa20; a mixing step during initialization allows using a long nonce and along with a full-sized block counter.

ChaCha12, ChaCha8: faster; lower security margin of safety.

Configuration

The default features are recommended unless you have special requirements; ppv-lite86 runs significantly faster than packed_simd on my machine that has SSE4.1 but not AVX2, compiles much faster, and builds on stable. To take advantage of AVX2 or AVX512, use packed_simd. NEON, WASM, and other platforms should work through packed_simd, but are unsupported as I haven't set up testing yet (if you're interested, file a bug!). Non-SIMD builds should be possible on any arch Rust can be compiled for.