Packages / rupm

chacha-tools 0.1.0

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

Install

cargo add chacha-tools --registry rupm

In Ruststudio: Packages, search for chacha-tools, Install.

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

Versions

README

# chacha-tools

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

Add it with `rupm add chacha-tools` (or `cargo add chacha-tools --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 = chacha_tools::aead_encrypt(&key, &nonce, b"header", b"secret message");
let opened = chacha_tools::aead_decrypt(&key, &nonce, b"header", &sealed).unwrap();
assert_eq!(opened, b"secret message");
assert!(chacha_tools::aead_decrypt(&key, &nonce, b"other", &sealed).is_err());
```