AESNI

hardware accelerated aes implementation makes use of intel AESNI

This code relies on intel AES and SSE2 instruction sets. If the CPU does not support all of these, an error will be thrown. Consider using checkHardwareAES() to check if aesni is supported.

Members

Functions

processBlock
uint processBlock(ubyte[] input, ubyte[] output)
Undocumented in source.
reset
void reset()
Undocumented in source. Be warned that the author may not have intended to support it.
start
void start(bool forEncryption, ubyte[] userKey, ubyte[] iv)

Manifest constants

blockSize
enum blockSize;
Undocumented in source.
name
enum name;
Undocumented in source.

Examples

Test AES encryption and decryption with different key sizes.

// test vectors from http://www.inconteam.com/software-development/41-encryption/55-aes-test-vectors

static string[] test_keys = [
	x"2b7e151628aed2a6abf7158809cf4f3c",
	x"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
	x"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"
];

static string[] test_plaintexts = [
	x"6bc1bee22e409f96e93d7e117393172a",
	x"6bc1bee22e409f96e93d7e117393172a",
	x"6bc1bee22e409f96e93d7e117393172a"
];

static string[] test_ciphertexts = [
	x"3ad77bb40d7a3660a89ecaf32466ef97",
	x"bd334f1d6e45f25ff712a214571fa5cc",
	x"f3eed1bdb5d2a03c064b5a7e3db181f8"

];

AESNIEngine t = new AESNIEngine();

blockCipherTest(t, test_keys, test_plaintexts, test_ciphertexts);

Meta