aes-0.3.0 has been yanked.
This crate is a wrapper around different implementations of AES block ciphers.
Currently it uses:
aes-soft
hardware independent bit-sliced implementationaesni
implementation using AES-NI instruction set. Used for x86-64 and x86 target architectures with enabledaes
andsse2
target features (the latter is usually enabled by default).
Crate switches between implementations automatically at compile time. (i.e. it does not use run-time feature detection)
Usage example
use GenericArray;
use BlockCipher;
use Aes128;
let key = from_slice;
let mut block = clone_from_slice;
let mut block8 = clone_from_slice;
// Initialize cipher
let cipher = new;
let block_copy = block.clone;
// Encrypt block in-place
cipher.encrypt_block;
// And decrypt it back
cipher.decrypt_block;
assert_eq!;
// We can encrypt 8 blocks simultaneously using
// instruction-level parallelism
let block8_copy = block8.clone;
cipher.encrypt_blocks;
cipher.decrypt_blocks;
assert_eq!;
For implementations of block cipher modes of operation see
block-modes
crate.