Mercurial > projects > dcrypt
diff dcrypt/crypto/ciphers/Blowfish.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/Blowfish.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/Blowfish.d Sun May 10 22:38:48 2009 -0400 @@ -203,18 +203,18 @@ 0xc0ac29b7u, 0xc97c50ddu, 0x3f84d5b5u, 0xb5470917u, 0x9216d5d9u, 0x8979fb1bu ]; - const uint BLOCK_SIZE = 8, - ROUNDS = 16, - SBOX_SIZE = 256, - PBOX_SIZE = 18, - MAX_KEY_SIZE = 56, // 448 bits - MIN_KEY_SIZE = 4; // 32 bits + static const uint BLOCK_SIZE = 8, + ROUNDS = 16, + SBOX_SIZE = 256, + PBOX_SIZE = 18, + MAX_KEY_SIZE = 56, // 448 bits + MIN_KEY_SIZE = 4; // 32 bits uint[18] P; uint[256] S0, S1, S2, S3; ubyte[] workingKey; } // end private - char[] name() + string name() { return "Blowfish"; } @@ -359,7 +359,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "0000000000000000", "ffffffffffffffff", "57686f206973204a6f686e2047616c743f", // I don't know, do you? @@ -369,7 +369,7 @@ "fedcba9876543210" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "0000000000000000", "ffffffffffffffff", "fedcba9876543210", @@ -379,7 +379,7 @@ "0123456789abcdef" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "4ef997456198dd78", "51866fd5b85ecb8a", "cc91732b8022f684", @@ -390,10 +390,10 @@ ]; Blowfish t = new Blowfish(); - 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