Packages / rupm

rs-crypto-chacha 0.1.0

ChaCha20 stream cipher, Poly1305 and ChaCha20-Poly1305 AEAD (RFC 8439), std only

Install

cargo add rs-crypto-chacha --registry rupm

In Ruststudio: Packages, search for rs-crypto-chacha, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-crypto-chacha

ChaCha20 stream cipher, Poly1305 and ChaCha20-Poly1305 AEAD (RFC 8439), std only

Add it with `rupm add rs-crypto-chacha` (or `cargo add rs-crypto-chacha --registry rupm`).

Matches the RFC 8439 test vectors. It is an unaudited, from-scratch implementation: never reuse a (key, nonce) pair, and do not use this crate for security-critical work; use an audited crate there.

```rust
let key = [7u8; 32];
let nonce = [1u8; 12];
let sealed = rs_crypto_chacha::aead_encrypt(&key, &nonce, b"header", b"secret message");
let opened = rs_crypto_chacha::aead_decrypt(&key, &nonce, b"header", &sealed).unwrap();
assert_eq!(opened, b"secret message");
assert!(rs_crypto_chacha::aead_decrypt(&key, &nonce, b"other", &sealed).is_err());
```