| Crates.io | chachacha |
| lib.rs | chachacha |
| version | 0.4.2 |
| created_at | 2025-04-09 09:15:53.812208+00 |
| updated_at | 2025-08-30 09:15:02.4377+00 |
| description | SIMD optimized implementations of the Chacha stream cipher |
| homepage | |
| repository | https://github.com/silverstillisntgold/chachacha |
| max_upload_size | |
| id | 1626449 |
| size | 94,697 |
Extremely fast ChaCha implementation. Primarily made for use as a CRNG in the ya-rand crate,
but should be just as usable anywhere else you might want to use ChaCha.
use chachacha::{BUF_LEN_U64, BUF_LEN_U8, ChaCha12Djb};
// Create a new `ChaCha12Djb` instance with a key that is all ones,
// a counter starting at 69, and a nonce of 0 and 1 (the last nonce
// value is discarded in the `Djb` variants).
let mut chacha = ChaCha12Djb::new([u32::MAX; 8],
69,
[0, 1, 2]);
// 256 bytes of output
let block_output: [u8; BUF_LEN_U8] = chacha.get_block();
let all_zeros = block_output.into_iter().all(|v| v == 0);
assert!(!all_zeros);