#cipher #crypto #byte #key #data #camellia

camellia-rs

Rust implementation of Camellia cipher

2 unstable releases

0.2.0 Apr 12, 2019
0.1.0 Apr 7, 2019

#2048 in Cryptography

MIT license

49KB
693 lines

camellia-rs

Rust implementation of Camellia cipher.

Usage

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);
    }
}

License

This library is licensed under MIT License.


lib.rs:

Rust implementation of Camellia cipher.

Safety

Unsafe codes are only used in Block.index() and index_mut().

No runtime deps