[][src]Crate aes_soft

AES block cipher constant-time implementation.

The aes-soft crate implements the AES algorithm completely in software without using any table lookups or other timing dependant mechanisms.

The encryption implementation is based on a technique called fixslicing, while the decryption implementation is heavily based on aessafe module, from the original rust-crypto crate.

Usage example

use aes_soft::cipher::generic_array::GenericArray;
use aes_soft::cipher::{BlockCipher, NewBlockCipher};
use aes_soft::Aes128;

let key = GenericArray::from_slice(&[0u8; 16]);
let mut block = GenericArray::clone_from_slice(&[0u8; 16]);
let mut block8 = GenericArray::clone_from_slice(&[block; 8]);
// Initialize cipher
let cipher = aes_soft::Aes128::new(&key);

let block_copy = block.clone();
// Encrypt block in-place
cipher.encrypt_block(&mut block);
// And decrypt it back
cipher.decrypt_block(&mut block);
assert_eq!(block, block_copy);

// We can encrypt 8 blocks simultaneously using
// instruction-level parallelism
let block8_copy = block8.clone();
cipher.encrypt_blocks(&mut block8);
cipher.decrypt_blocks(&mut block8);
assert_eq!(block8, block8_copy);


pub use cipher;



AES-128 block cipher instance


AES-192 block cipher instance


AES-256 block cipher instance

Type Definitions


128-bit AES block


8 x 128-bit AES blocks to be processed in parallel