comparison dcrypt/crypto/ciphers/AES.d @ 26:176c933827a8

Implemented MD4. Refactored MD5. Replaced all instances of 'version (UnitTest)' with 'debug (UnitTest)'.
author Thomas Dixon <reikon@reikon.us>
date Sun, 01 Mar 2009 13:06:48 -0500
parents 4589f8c5eb3c
children 8b5eaf3c2979
comparison
equal deleted inserted replaced
25:528676d20398 26:176c933827a8
849 849
850 if (i % nk == 0) 850 if (i % nk == 0)
851 t = subWord(Bitwise.rotateLeft(t, 8)) ^ RCON[(i/nk)-1]; 851 t = subWord(Bitwise.rotateLeft(t, 8)) ^ RCON[(i/nk)-1];
852 else if (nk > 6 && (i % nk == 4)) 852 else if (nk > 6 && (i % nk == 4))
853 t = subWord(t); 853 t = subWord(t);
854
854 w[i] = w[i-nk] ^ t; 855 w[i] = w[i-nk] ^ t;
855 } 856 }
856 857
857 if (!_encrypt) { 858 if (!_encrypt) {
858 for (uint i = 0; i <= 4*ROUNDS; i+=4) 859 for (uint i = 0; i <= 4*ROUNDS; i+=4)
867 } 868 }
868 } 869 }
869 } 870 }
870 871
871 /** Some AES test vectors from the FIPS-197 paper and BC. */ 872 /** Some AES test vectors from the FIPS-197 paper and BC. */
872 version (UnitTest) { 873 debug (UnitTest) {
873 unittest { 874 unittest {
874 static const char[][] test_keys = [ 875 static const char[][] test_keys = [
875 "000102030405060708090a0b0c0d0e0f", 876 "000102030405060708090a0b0c0d0e0f",
876 "000102030405060708090a0b0c0d0e0f1011121314151617", 877 "000102030405060708090a0b0c0d0e0f1011121314151617",
877 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", 878 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",