Registry / crypto / chacha20

chacha20

JSON →
library0.10.0rscratesunverified

The ChaCha20 stream cipher (RFC 8439) implemented in pure Rust using traits from the RustCrypto `cipher` crate, with optional architecture-specific hardware acceleration (AVX2, SSE2). Additionally provides the ChaCha8, ChaCha12, XChaCha20, XChaCha12 and XChaCha8 stream ciphers, and also optional rand_core-compatible RNGs based on those ciphers.

# Cargo.toml [dependencies] chacha20 = "0.10.0"
INSTALL
IMPORT
SIG · CHACHA20
C
chacha20
cryptorustv0.10.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ChaCha20
use chacha20::ChaCha20;

Encrypts a 64-byte buffer using ChaCha20 with a zero key and nonce.

use chacha20::ChaCha20; use chacha20::cipher::{KeyIvInit, StreamCipher}; fn main() { let key = [0u8; 32]; let nonce = [0u8; 12]; let mut cipher = ChaCha20::new(&key.into(), &nonce.into()); let mut data = [0u8; 64]; cipher.apply_keystream(&mut data); println!("Encrypted: {:?}", data); }
Debug
Known issues
gotchaRequires the `cipher` crate for trait imports
fix
Add `cipher` to your dependencies and import `KeyIvInit` and `StreamCipher`
affects: >=0.10.0
Upgrade
Version history
0.10.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
Amazon
1
Resources
chacha20 — cargo add chacha20 · libregistry