Module cryptoxide::salsa20 [−][src]
Expand description
Salsa20 Stream Cipher
Examples
Combine a simple input using a 128 bits key and 64 bit nonce:
use cryptoxide::salsa20::Salsa20;
let key : [u8; 16] = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
let nonce : [u8; 8] = [1,2,3,4,5,6,7,8];
let input : &[u8; 12] = b"hello world!";
let mut out : [u8; 12] = [0u8; 12];
// create a new cipher
let mut cipher = Salsa20::new(&key, &nonce);
// encrypt the msg
cipher.process(input, &mut out);