Mercurial > projects > dcrypt
diff dcrypt/crypto/ciphers/AES.d @ 28:ad687db713a4
Further reworked the code for hash padding. Replaced all instances of 'char[]' with 'string' and removed a few 'const' modifiers as per Glenn Haecker's patch for D2 compatibility. Updated CONTRIBUTORS file.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Sun, 10 May 2009 22:38:48 -0400 |
parents | 8b5eaf3c2979 |
children |
line wrap: on
line diff
--- a/dcrypt/crypto/ciphers/AES.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/AES.d Sun May 10 22:38:48 2009 -0400 @@ -637,7 +637,7 @@ 0xcb84617bu, 0x32b670d5u, 0x6c5c7448u, 0xb85742d0u ]; - const uint BLOCK_SIZE = 16; + static const uint BLOCK_SIZE = 16; uint ROUNDS, // Number of rounds depends on keysize s0, s1, s2, s3; // State @@ -646,7 +646,7 @@ } // end private - char[] name() + string name() { return "AES"; } @@ -894,7 +894,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "000102030405060708090a0b0c0d0e0f", "000102030405060708090a0b0c0d0e0f1011121314151617", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", @@ -903,7 +903,7 @@ "0000000000000000000000000000000000000000000000000000000000000000" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "00112233445566778899aabbccddeeff", "00112233445566778899aabbccddeeff", "00112233445566778899aabbccddeeff", @@ -912,7 +912,7 @@ "80000000000000000000000000000000" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "69c4e0d86a7b0430d8cdb78070b4c55a", "dda97ca4864cdfe06eaf70a0ec0d7191", "8ea2b7ca516745bfeafc49904b496089", @@ -923,10 +923,10 @@ ]; AES t = new AES(); - foreach (uint i, char[] test_key; test_keys) + foreach (uint i, string test_key; test_keys) { ubyte[] buffer = new ubyte[t.blockSize]; - char[] result; + string result; SymmetricKey key = new SymmetricKey(ByteConverter.hexDecode(test_key)); // Encryption