Crates.io | camellia-rs |
lib.rs | camellia-rs |
version | 0.2.0 |
source | src |
created_at | 2019-04-07 12:28:42.779593 |
updated_at | 2019-04-12 06:22:58.897555 |
description | Rust implementation of Camellia cipher. |
homepage | |
repository | https://github.com/dobasy/camellia-rs |
max_upload_size | |
id | 126341 |
size | 51,345 |
Rust implementation of Camellia cipher.
use camellia_rs::*;
fn encrypt(key: &[u8], data: &mut [u8]) {
assert_eq!(data.len() % 16, 0);
let cipher = CamelliaCipher::new(key).unwrap();
let mut buf = Block::default();
for i in (0..key.len()).step_by(16) {
buf.bytes.copy_from_slice(&data[i..(i + 16)]);
cipher.encrypt(&mut buf);
data[i..(i + 16)].copy_from_slice(&buf.bytes);
}
}
This library is licensed under MIT License.