3 releases (breaking)

Uses old Rust 2015

0.3.0 Jan 27, 2019
0.2.0 Sep 13, 2018
0.1.0 Mar 6, 2016

#1113 in Cryptography

Download history 33095/week @ 2024-07-28 37206/week @ 2024-08-04 47434/week @ 2024-08-11 32970/week @ 2024-08-18 42629/week @ 2024-08-25 48737/week @ 2024-09-01 41387/week @ 2024-09-08 37707/week @ 2024-09-15 41833/week @ 2024-09-22 41798/week @ 2024-09-29 43592/week @ 2024-10-06 43496/week @ 2024-10-13 50256/week @ 2024-10-20 39304/week @ 2024-10-27 53059/week @ 2024-11-03 40188/week @ 2024-11-10

183,924 downloads per month
Used in 102 crates (9 directly)

MIT/Apache

36KB
635 lines

documenation crates.io link

Adding a Dependency

If you are using a stable Rust build:

[dependencies]
chacha = "0.1.0"

If you need maximum performance, using a nightly Rust build:

[dependencies.chacha]
version = "0.1.0"
features = ["nightly"]

Example

extern crate chacha;

use chacha::{ChaCha, KeyStream};

fn main() {
    let secret_key = [
        0x29, 0xfa, 0x35, 0x60, 0x88, 0x45, 0xc6, 0xf9, 
        0xd8, 0xfe, 0x65, 0xe3, 0x22, 0x0e, 0x5b, 0x05, 
        0x03, 0x4a, 0xa0, 0x9f, 0x9e, 0x27, 0xad, 0x0f, 
        0x6c, 0x90, 0xa5, 0x73, 0xa8, 0x10, 0xe4, 0x94, 
    ];
    let nonce = [0u8; 8];
    let mut stream = ChaCha::new_chacha20(&secret_key, &nonce);

    let mut buffer = *b"abcdef";
    println!("Plaintext = {:?}", buffer);
    stream.xor_read(&mut buffer[..]).expect("hit end of stream far too soon");
    println!("Ciphertext = {:?}", buffer);
}

Dependencies

~120KB