Crates.io | chiapos-chacha8 |
lib.rs | chiapos-chacha8 |
version | 0.1.0 |
source | src |
created_at | 2021-09-18 07:30:56.467464 |
updated_at | 2021-09-18 07:30:56.467464 |
description | A chiapos compatible implementation of chiapos-chacha8. NOTE: This is not an implementation of standard ChaCha8 and should not be used as such. |
homepage | |
repository | |
max_upload_size | |
id | 453224 |
size | 20,955 |
This is a byte-for-byte compatible implementation of chiapos' ChaCha8 in Rust. It has been manually verified in a custom implementation of chiapos in Rust to produce identical output.
On top of producing identical output, this implementation is also multi-threaded using Rayon producing data extremely fast.
This crate has some strict expectations that match the original use-case:
// Randomize this key however you would like
let mut key = [0u8; 32];
let chacha8 = ChaCha8::new_from_256bit_key(&key);
// Output data goes in this vec, note that 64 * 8 = 512bits
let num_blocks = 128;
let mut chacha_blocks = vec![0u8; 64 * num_blocks];
// pos is the offset in the output keystream
let pos = 0;
chacha8.get_keystream(pos, &mut chacha_blocks);
This crate generates pseudorandom data extremely fast in 512bit blocks. The output is also deterministic for the same inputs.
This crate makes no guarantees about: