# HG changeset patch # User Thomas Dixon # Date 1242009528 14400 # Node ID ad687db713a418f3fd63b5515030dd74e2827761 # Parent 8b5eaf3c297954befc76e8dfbf7747fdf8d483a2 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. diff -r 8b5eaf3c2979 -r ad687db713a4 CONTRIBUTORS --- a/CONTRIBUTORS Sat May 09 23:29:20 2009 -0400 +++ b/CONTRIBUTORS Sun May 10 22:38:48 2009 -0400 @@ -1,3 +1,4 @@ -Thomas Dixon +Thomas Dixon Daniel Korsgaard <#d @ irc.freenode.net> Robert Smith +Glenn Haecker diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/BlockCipherPadding.d --- a/dcrypt/crypto/BlockCipherPadding.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/BlockCipherPadding.d Sun May 10 22:38:48 2009 -0400 @@ -14,7 +14,7 @@ abstract class BlockCipherPadding { /** Returns: The name of the padding scheme implemented. */ - char[] name(); + string name(); /** * Generate padding to a specific length. diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/Cipher.d --- a/dcrypt/crypto/Cipher.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/Cipher.d Sun May 10 22:38:48 2009 -0400 @@ -46,7 +46,7 @@ uint update(void[] input_, void[] output_); /** Returns: The name of the algorithm of this cipher. */ - char[] name(); + string name(); /** Returns: Whether or not the cipher has been initialized. */ bool initialized() diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/Hash.d --- a/dcrypt/crypto/Hash.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/Hash.d Sun May 10 22:38:48 2009 -0400 @@ -43,7 +43,7 @@ abstract uint digestSize(); /** Returns: The name of the algorithm we're implementing. */ - abstract char[] name(); + abstract string name(); /** Returns: A copy of this hash object. */ abstract Hash copy(); @@ -96,7 +96,7 @@ } // Pad with null bytes - while ((index & (blockSize - 1)) != (blockSize - long.sizeof)) + while ((index & (blockSize - 1)) != (blockSize - (blockSize >> 3))) { buffer[index++] = 0; @@ -108,12 +108,12 @@ } // Length padding - for (int i = 0; i < 64; i+=8) // little endian - buffer[index++] = bits >> i; - + for (int i = 0; i < blockSize; i+=8, bits>>=8) // little endian + buffer[index++] = bits; + if (mode == MODE_SHA) - buffer[index-ulong.sizeof..index].reverse; // big endian - + buffer[(buffer.length-(blockSize >> 3))..buffer.length].reverse; // big endian + transform(buffer); index = 0; } @@ -131,7 +131,7 @@ * * Returns: Representation of the final hash value in hex. */ - char[] hexDigest() + string hexDigest() { return ByteConverter.hexEncode(digest()); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/MAC.d --- a/dcrypt/crypto/MAC.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/MAC.d Sun May 10 22:38:48 2009 -0400 @@ -33,7 +33,7 @@ void update(void[] input_); /** Returns: The name of this MAC. */ - char[] name(); + string name(); /** Reset MAC to its state immediately subsequent the last init. */ void reset(); @@ -48,7 +48,7 @@ ubyte[] digest(); /** Returns: The computed MAC in hexadecimal. */ - char[] hexDigest() + string hexDigest() { return ByteConverter.hexEncode(digest()); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ManagedBlockCipher.d --- a/dcrypt/crypto/ManagedBlockCipher.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ManagedBlockCipher.d Sun May 10 22:38:48 2009 -0400 @@ -43,7 +43,7 @@ { this.cipher = cipher; - char[] mode = cipher.name; + string mode = cipher.name; int i; for (i = 0; i < mode.length; i++) if (mode[i] == '/') @@ -65,7 +65,7 @@ cipher.init(encrypt, params); } - char[] name() + string name() { if (padding is null) return cipher.name; diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/PRNG.d --- a/dcrypt/crypto/PRNG.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/PRNG.d Sun May 10 22:38:48 2009 -0400 @@ -43,5 +43,5 @@ uint read(ubyte[] output); /** Returns: The name of the PRNG algorithm */ - char[] name(); + string name(); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/AES.d --- 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 diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/Blowfish.d --- 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 diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/ChaCha.d --- a/dcrypt/crypto/ciphers/ChaCha.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/ChaCha.d Sun May 10 22:38:48 2009 -0400 @@ -17,7 +17,7 @@ /** Implementation of ChaCha designed by Daniel J. Bernstein. */ class ChaCha : Salsa20 { - char[] name() + string name() { return "ChaCha"; } @@ -117,7 +117,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "80000000000000000000000000000000", "0053a6f94c9ff24598eb3e91e4378add", "00002000000000000000000000000000"~ @@ -127,14 +127,14 @@ ]; - static const char[][] test_ivs = [ + static string[] test_ivs = [ "0000000000000000", "0d74db42a91077de", "0000000000000000", "288ff65dc42b92f9" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "00000000000000000000000000000000"~ "00000000000000000000000000000000"~ "00000000000000000000000000000000"~ @@ -158,7 +158,7 @@ ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "beb1e81e0f747e43ee51922b3e87fb38"~ "d0163907b4ed49336032ab78b67c2457"~ "9fe28f751bd3703e51d876c017faa435"~ @@ -182,7 +182,7 @@ ChaCha cc = new ChaCha(); ubyte[] buffer = new ubyte[64]; - char[] result; + string result; for (int i = 0; i < test_keys.length; i++) { SymmetricKey key = new SymmetricKey(ByteConverter.hexDecode(test_keys[i])); diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/RC4.d --- a/dcrypt/crypto/ciphers/RC4.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/RC4.d Sun May 10 22:38:48 2009 -0400 @@ -47,7 +47,7 @@ _encrypt = _initialized = true; } - char[] name() + string name() { return "RC4"; } @@ -116,7 +116,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "0123456789abcdef", "0123456789abcdef", "0000000000000000", @@ -124,7 +124,7 @@ "0123456789abcdef" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "0123456789abcdef", "0000000000000000", "0000000000000000", @@ -163,7 +163,7 @@ "01010101010101010101010101010101" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "75b7878099e0c596", "7494c2e7104b0879", "de188941a3375d3a", @@ -203,10 +203,10 @@ ]; RC4 r = new RC4(); - foreach (uint i, char[] test_key; test_keys) + foreach (uint i, string test_key; test_keys) { ubyte[] buffer = new ubyte[test_plaintexts[i].length>>1]; - char[] result; + string result; r.init(true, new SymmetricKey(ByteConverter.hexDecode(test_key))); diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/RC6.d --- a/dcrypt/crypto/ciphers/RC6.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/RC6.d Sun May 10 22:38:48 2009 -0400 @@ -29,16 +29,16 @@ { private { - const uint ROUNDS = 20, - BLOCK_SIZE = 16, - // Magic constants for a 32 bit word size - P = 0xb7e15163, - Q = 0x9e3779b9; + static const uint ROUNDS = 20, + BLOCK_SIZE = 16, + // Magic constants for a 32 bit word size + P = 0xb7e15163, + Q = 0x9e3779b9; uint[] S; ubyte[] workingKey; } - char[] name() + string name() { return "RC6"; } @@ -172,7 +172,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "00000000000000000000000000000000", "0123456789abcdef0112233445566778", "00000000000000000000000000000000"~ @@ -185,7 +185,7 @@ "899aabbccddeeff01032547698badcfe" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "00000000000000000000000000000000", "02132435465768798a9bacbdcedfe0f1", "00000000000000000000000000000000", @@ -194,7 +194,7 @@ "02132435465768798a9bacbdcedfe0f1" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "8fc3a53656b1f778c129df4e9848a41e", "524e192f4715c6231f51f6367ea43f18", "6cd61bcb190b30384e8a3f168690ae82", @@ -204,10 +204,10 @@ ]; RC6 t = new RC6(); - 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 diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/Salsa20.d --- a/dcrypt/crypto/ciphers/Salsa20.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/Salsa20.d Sun May 10 22:38:48 2009 -0400 @@ -19,8 +19,8 @@ protected { // Constants - const ubyte[] sigma = cast(ubyte[])"expand 32-byte k", - tau = cast(ubyte[])"expand 16-byte k"; + static ubyte[] sigma = cast(ubyte[])"expand 32-byte k", + tau = cast(ubyte[])"expand 16-byte k"; // Counter indexes (added for ChaCha) uint i0, i1; @@ -85,7 +85,7 @@ _encrypt = _initialized = true; } - char[] name() + string name() { return "Salsa20"; } @@ -235,7 +235,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "80000000000000000000000000000000", "0053a6f94c9ff24598eb3e91e4378add", "00002000000000000000000000000000"~ @@ -245,14 +245,14 @@ ]; - static const char[][] test_ivs = [ + static string[] test_ivs = [ "0000000000000000", "0d74db42a91077de", "0000000000000000", "288ff65dc42b92f9" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "00000000000000000000000000000000"~ "00000000000000000000000000000000"~ "00000000000000000000000000000000"~ @@ -276,7 +276,7 @@ ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "4dfa5e481da23ea09a31022050859936"~ // Expected output "da52fcee218005164f267cb65f5cfd7f"~ "2b4f97e0ff16924a52df269515110a07"~ @@ -300,7 +300,7 @@ Salsa20 s20 = new Salsa20(); ubyte[] buffer = new ubyte[64]; - char[] result; + string result; for (int i = 0; i < test_keys.length; i++) { SymmetricKey key = new SymmetricKey(ByteConverter.hexDecode(test_keys[i])); diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/TEA.d --- a/dcrypt/crypto/ciphers/TEA.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/TEA.d Sun May 10 22:38:48 2009 -0400 @@ -17,17 +17,17 @@ { private { - const uint ROUNDS = 32, - KEY_SIZE = 16, - BLOCK_SIZE = 8, - DELTA = 0x9e3779b9u, - DECRYPT_SUM = 0xc6ef3720u; + static const uint ROUNDS = 32, + KEY_SIZE = 16, + BLOCK_SIZE = 8, + DELTA = 0x9e3779b9u, + DECRYPT_SUM = 0xc6ef3720u; uint sk0, sk1, sk2, sk3, sum; } void reset(){} - char[] name() + string name() { return "TEA"; } @@ -103,21 +103,21 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "00000000000000000000000000000000", "00000000000000000000000000000000", "0123456712345678234567893456789a", "0123456712345678234567893456789a" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "0000000000000000", "0102030405060708", "0000000000000000", "0102030405060708" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "41ea3a0a94baa940", "6a2f9cf3fccf3c55", "34e943b0900f5dcb", @@ -126,10 +126,10 @@ TEA t = new TEA(); - 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 diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/ciphers/XTEA.d --- a/dcrypt/crypto/ciphers/XTEA.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/ciphers/XTEA.d Sun May 10 22:38:48 2009 -0400 @@ -17,10 +17,10 @@ { private { - const uint ROUNDS = 32, - KEY_SIZE = 16, - BLOCK_SIZE = 8, - DELTA = 0x9e3779b9u; + static const uint ROUNDS = 32, + KEY_SIZE = 16, + BLOCK_SIZE = 8, + DELTA = 0x9e3779b9u; uint[] subkeys, sum0, sum1; @@ -28,7 +28,7 @@ void reset(){} - char[] name() + string name() { return "XTEA"; } @@ -115,7 +115,7 @@ { unittest { - static const char[][] test_keys = [ + static string[] test_keys = [ "00000000000000000000000000000000", "00000000000000000000000000000000", "0123456712345678234567893456789a", @@ -128,7 +128,7 @@ "00000000000000000000000000000000" ]; - static const char[][] test_plaintexts = [ + static string[] test_plaintexts = [ "0000000000000000", "0102030405060708", "0000000000000000", @@ -141,7 +141,7 @@ "4141414141414141" ]; - static const char[][] test_ciphertexts = [ + static string[] test_ciphertexts = [ "dee9d4d8f7131ed9", "065c1b8975c6a816", "1ff9a0261ac64264", @@ -155,10 +155,10 @@ ]; XTEA t = new XTEA(); - 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 diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/InvalidKeyError.d --- a/dcrypt/crypto/errors/InvalidKeyError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/InvalidKeyError.d Sun May 10 22:38:48 2009 -0400 @@ -11,5 +11,5 @@ import dcrypt.crypto.errors.InvalidParameterError; class InvalidKeyError : InvalidParameterError { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/InvalidPaddingError.d --- a/dcrypt/crypto/errors/InvalidPaddingError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/InvalidPaddingError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.InvalidPaddingError; class InvalidPaddingError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/InvalidParameterError.d --- a/dcrypt/crypto/errors/InvalidParameterError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/InvalidParameterError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.InvalidParameterError; class InvalidParameterError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/LimitReachedError.d --- a/dcrypt/crypto/errors/LimitReachedError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/LimitReachedError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.LimitReachedError; class LimitReachedError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/NotInitializedError.d --- a/dcrypt/crypto/errors/NotInitializedError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/NotInitializedError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.NotInitializedError; class NotInitializedError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/NotSupportedError.d --- a/dcrypt/crypto/errors/NotSupportedError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/NotSupportedError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.NotSupportedError; class NotSupportedError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/errors/ShortBufferError.d --- a/dcrypt/crypto/errors/ShortBufferError.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/errors/ShortBufferError.d Sun May 10 22:38:48 2009 -0400 @@ -9,5 +9,5 @@ module dcrypt.crypto.errors.ShortBufferError; class ShortBufferError : Exception { - this(char[] msg) { super(msg); } + this(string msg) { super(msg); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/MD4.d --- a/dcrypt/crypto/hashes/MD4.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/MD4.d Sun May 10 22:38:48 2009 -0400 @@ -19,7 +19,7 @@ */ class MD4 : Hash { - private uint h0, h1, h2, h3; + private uint h0, h1, h2, h3; // Shift amounts private enum @@ -56,7 +56,7 @@ return 16; } - char[] name() + string name() { return "MD4"; } @@ -168,7 +168,7 @@ ubyte[] digest() { - padMessage(MODE_MD); + padMessage(MODE_MD); ubyte[] result = new ubyte[digestSize]; result[0..4] = ByteConverter.LittleEndian.from!(uint)(h0); @@ -202,10 +202,9 @@ debug (UnitTest) { - // Found in Tango <3 unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "a", "abc", @@ -215,7 +214,7 @@ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" ]; - static const char[][] test_results = [ + static string[] test_results = [ "31d6cfe0d16ae931b73c59d7e0c089c0", "bde52cb31de33e46245e05fbdbd6fb24", "a448017aaf21d8525fc10ae87aa6729d", @@ -226,10 +225,10 @@ ]; MD4 h = new MD4(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/MD5.d --- a/dcrypt/crypto/hashes/MD5.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/MD5.d Sun May 10 22:38:48 2009 -0400 @@ -19,7 +19,7 @@ */ class MD5 : Hash { - private uint h0, h1, h2, h3; + private uint h0, h1, h2, h3; // Shift amounts private enum @@ -61,7 +61,7 @@ return 16; } - char[] name() + string name() { return "MD5"; } @@ -208,7 +208,7 @@ ubyte[] digest() { - padMessage(MODE_MD); + padMessage(MODE_MD); ubyte[] result = new ubyte[digestSize]; result[0..4] = ByteConverter.LittleEndian.from!(uint)(h0); @@ -245,7 +245,7 @@ // Found in Tango <3 unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "a", "abc", @@ -255,7 +255,7 @@ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" ]; - static const char[][] test_results = [ + static string[] test_results = [ "d41d8cd98f00b204e9800998ecf8427e", "0cc175b9c0f1b6a831c399e269772661", "900150983cd24fb0d6963f7d28e17f72", @@ -266,10 +266,10 @@ ]; MD5 h = new MD5(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/SHA1.d --- a/dcrypt/crypto/hashes/SHA1.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/SHA1.d Sun May 10 22:38:48 2009 -0400 @@ -19,7 +19,7 @@ */ class SHA1 : Hash { - protected uint h0, h1, h2, h3, h4; + protected uint h0, h1, h2, h3, h4; this (void[] input_=null) { @@ -37,7 +37,7 @@ return 20; } - char[] name() + string name() { return "SHA1"; } @@ -160,7 +160,7 @@ ubyte[] digest() { - padMessage(MODE_SHA); + padMessage(MODE_SHA); ubyte[] result = new ubyte[digestSize]; result[0..4] = ByteConverter.BigEndian.from!(uint)(h0); @@ -199,7 +199,7 @@ { unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", @@ -207,11 +207,11 @@ "0123456701234567012345670123456701234567012345670123456701234567" ]; - static const int[] test_repeat = [ + static int[] test_repeat = [ 1, 1, 1, 1000000, 10 ]; - static const char[][] test_results = [ + static string[] test_results = [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "a9993e364706816aba3e25717850c26c9cd0d89d", "84983e441c3bd26ebaae4aa1f95129e5e54670f1", @@ -220,11 +220,11 @@ ]; SHA1 h = new SHA1(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { for (int j = 0; j < test_repeat[i]; j++) h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/SHA224.d --- a/dcrypt/crypto/hashes/SHA224.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/SHA224.d Sun May 10 22:38:48 2009 -0400 @@ -29,14 +29,14 @@ return 28; } - char[] name() + string name() { return "SHA224"; } ubyte[] digest() { - padMessage(MODE_SHA); + padMessage(MODE_SHA); ubyte[] result = new ubyte[digestSize]; @@ -84,18 +84,18 @@ { unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "a" ]; - static const int[] test_repeat = [ + static int[] test_repeat = [ 1, 1, 1, 1000000 ]; - static const char[][] test_results = [ + static string[] test_results = [ "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525", @@ -103,11 +103,11 @@ ]; SHA224 h = new SHA224(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { for (int j = 0; j < test_repeat[i]; j++) h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/SHA256.d --- a/dcrypt/crypto/hashes/SHA256.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/SHA256.d Sun May 10 22:38:48 2009 -0400 @@ -18,7 +18,7 @@ */ class SHA256 : Hash { - private const uint[] K = [ + private static const uint[] K = [ 0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u, 0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, @@ -37,7 +37,7 @@ 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u ]; - protected uint h0, h1, h2, h3, h4, h5, h6, h7; + protected uint h0, h1, h2, h3, h4, h5, h6, h7; this (void[] input_=null) { @@ -55,7 +55,7 @@ return 32; } - char[] name() + string name() { return "SHA256"; } @@ -135,7 +135,7 @@ ubyte[] digest() { - padMessage(MODE_SHA); + padMessage(MODE_SHA); ubyte[] result = new ubyte[digestSize]; result[0..4] = ByteConverter.BigEndian.from!(uint)(h0); @@ -183,18 +183,18 @@ { unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "a" ]; - static const int[] test_repeat = [ + static int[] test_repeat = [ 1, 1, 1, 1000000 ]; - static const char[][] test_results = [ + static string[] test_results = [ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1", @@ -202,11 +202,11 @@ ]; SHA256 h = new SHA256(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { for (int j = 0; j < test_repeat[i]; j++) h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/SHA384.d --- a/dcrypt/crypto/hashes/SHA384.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/SHA384.d Sun May 10 22:38:48 2009 -0400 @@ -29,14 +29,14 @@ return 48; } - char[] name() + string name() { return "SHA384"; } ubyte[] digest() { - padMessage(MODE_SHA); + padMessage(MODE_SHA); ubyte[] result = new ubyte[digestSize]; result[0..8] = ByteConverter.BigEndian.from!(ulong)(h0); @@ -82,7 +82,7 @@ { unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "abc", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"~ @@ -90,11 +90,11 @@ "a" ]; - static const int[] test_repeat = [ + static int[] test_repeat = [ 1, 1, 1, 1000000 ]; - static const char[][] test_results = [ + static string[] test_results = [ "38b060a751ac96384cd9327eb1b1e36a21fdb71114be0743"~ "4c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", @@ -109,11 +109,11 @@ ]; SHA384 h = new SHA384(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { for (int j = 0; j < test_repeat[i]; j++) h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/hashes/SHA512.d --- a/dcrypt/crypto/hashes/SHA512.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/hashes/SHA512.d Sun May 10 22:38:48 2009 -0400 @@ -18,7 +18,7 @@ */ class SHA512 : Hash { - private const ulong[] K = [ + private static const ulong[] K = [ 0x428a2f98d728ae22u, 0x7137449123ef65cdu, 0xb5c0fbcfec4d3b2fu, 0xe9b5dba58189dbbcu, 0x3956c25bf348b538u, 0x59f111f1b605d019u, 0x923f82a4af194f9bu, 0xab1c5ed5da6d8118u, 0xd807aa98a3030242u, 0x12835b0145706fbeu, 0x243185be4ee4b28cu, 0x550c7dc3d5ffb4e2u, @@ -41,7 +41,7 @@ 0x4cc5d4becb3e42b6u, 0x597f299cfc657e2au, 0x5fcb6fab3ad6faecu, 0x6c44198c4a475817u ]; - protected ulong h0, h1, h2, h3, h4, h5, h6, h7; + protected ulong h0, h1, h2, h3, h4, h5, h6, h7; this (void[] input_=null) { @@ -59,7 +59,7 @@ return 64; } - char[] name() + string name() { return "SHA512"; } @@ -143,7 +143,7 @@ ubyte[] digest() { - padMessage(MODE_SHA); + padMessage(MODE_SHA); ubyte[] result = new ubyte[digestSize]; result[0..8] = ByteConverter.BigEndian.from!(ulong)(h0); @@ -191,7 +191,7 @@ { unittest { - static const char[][] test_inputs = [ + static string[] test_inputs = [ "", "abc", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"~ @@ -199,11 +199,11 @@ "a" ]; - static const int[] test_repeat = [ + static int[] test_repeat = [ 1, 1, 1, 1000000 ]; - static const char[][] test_results = [ + static string[] test_results = [ "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce"~ "47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", @@ -218,11 +218,11 @@ ]; SHA512 h = new SHA512(); - foreach (uint i, char[] input; test_inputs) + foreach (uint i, string input; test_inputs) { for (int j = 0; j < test_repeat[i]; j++) h.update(input); - char[] digest = h.hexDigest(); + string digest = h.hexDigest(); assert(digest == test_results[i], h.name~": ("~digest~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/macs/HMAC.d --- a/dcrypt/crypto/macs/HMAC.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/macs/HMAC.d Sun May 10 22:38:48 2009 -0400 @@ -83,7 +83,7 @@ hash.update(input_); } - char[] name() + string name() { return "HMAC-"~hash.name; } @@ -116,7 +116,7 @@ return r; } - char[] hexDigest() + string hexDigest() { return ByteConverter.hexEncode(digest()); } @@ -134,7 +134,7 @@ { unittest { - static char[][] test_keys = [ + static string[] test_keys = [ "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", "4a656665", // Jefe? "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", @@ -144,7 +144,7 @@ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ]; - static char[][] test_inputs = [ + static string[] test_inputs = [ "4869205468657265", "7768617420646f2079612077616e7420666f72206e6f7468696e673f", "dd", @@ -156,7 +156,7 @@ 1, 1, 50, 1 ]; - static const char[][] test_results = [ + static const string[] test_results = [ "b617318655057264e28bc0b6fb378c8ef146be00", "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79", "125d7342b9ac11cd91a39af48aa17b4f63f175d3", @@ -164,12 +164,12 @@ ]; HMAC h = new HMAC(new SHA1()); - foreach (uint i, char[] k; test_keys) + foreach (uint i, string k; test_keys) { h.init(new SymmetricKey(ByteConverter.hexDecode(k))); for (int j = 0; j < test_repeat[i]; j++) h.update(ByteConverter.hexDecode(test_inputs[i])); - char[] mac = h.hexDigest(); + string mac = h.hexDigest(); assert(mac == test_results[i], h.name~": ("~mac~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/modes/CBC.d --- a/dcrypt/crypto/modes/CBC.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/modes/CBC.d Sun May 10 22:38:48 2009 -0400 @@ -44,7 +44,7 @@ return wrappedCipher; } - char[] name() + string name() { return wrappedCipher.name~"/CBC"; } @@ -138,13 +138,13 @@ { unittest { - static const char[][] test_keys = [ + static const string[] test_keys = [ "00000000000000000000000000000000", "00000000000000000000000000000000", "0123456789abcdef0123456789abcdef" ]; - static const char[][] test_plaintexts = [ + static const string[] test_plaintexts = [ "00000000000000000000000000000000"~ "00000000000000000000000000000000", @@ -154,8 +154,8 @@ "01010101010101010101010101010101"~ "01010101010101010101010101010101" ]; - - static const char[][] test_ciphertexts = [ + + static const string[] test_ciphertexts = [ "dee9d4d8f7131ed9b0e40a036a85d2c4"~ "4602d6e67f0c603738197998166ef281", @@ -169,7 +169,7 @@ CBC c = new CBC(new XTEA); ubyte[] iv = new ubyte[c.blockSize], // Initialized to 0 buffer = new ubyte[32]; - char[] result; + string result; for (int i = 0; i < test_keys.length; i++) { SymmetricKey key = new SymmetricKey(ByteConverter.hexDecode(test_keys[i])); diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/modes/CTR.d --- a/dcrypt/crypto/modes/CTR.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/modes/CTR.d Sun May 10 22:38:48 2009 -0400 @@ -40,7 +40,7 @@ return wrappedCipher; } - char[] name() + string name() { return wrappedCipher.name~"/CTR"; } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/padding/NullByte.d --- a/dcrypt/crypto/padding/NullByte.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/padding/NullByte.d Sun May 10 22:38:48 2009 -0400 @@ -15,7 +15,7 @@ * Ex. [... 0x00, 0x00 ... 0x00] */ class NullByte : BlockCipherPadding { - char[] name() + string name() { return "NullByte"; } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/padding/PKCS7.d --- a/dcrypt/crypto/padding/PKCS7.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/padding/PKCS7.d Sun May 10 22:38:48 2009 -0400 @@ -16,7 +16,7 @@ */ class PKCS7 : BlockCipherPadding { - char[] name() + string name() { return "PKCS7"; } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/padding/RFC1321.d --- a/dcrypt/crypto/padding/RFC1321.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/padding/RFC1321.d Sun May 10 22:38:48 2009 -0400 @@ -16,7 +16,7 @@ */ class RFC1321 : BlockCipherPadding { - char[] name() + string name() { return "RFC1321"; } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/padding/X923.d --- a/dcrypt/crypto/padding/X923.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/padding/X923.d Sun May 10 22:38:48 2009 -0400 @@ -16,7 +16,7 @@ */ class X923 : BlockCipherPadding { - char[] name() + string name() { return "X923"; } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/prngs/PBKDF2.d --- a/dcrypt/crypto/prngs/PBKDF2.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/prngs/PBKDF2.d Sun May 10 22:38:48 2009 -0400 @@ -28,7 +28,7 @@ ubyte[] salt, buffer; - char[] password; + string password; MAC prf; @@ -44,7 +44,7 @@ * iterations = The number of total iterations * prf = The pseudo-random function */ - this(char[] password, void[] salt_, uint iterations=1000, MAC prf=new HMAC(new SHA1)) + this(string password, void[] salt_, uint iterations=1000, MAC prf=new HMAC(new SHA1)) { salt = cast(ubyte[])salt_; @@ -111,7 +111,7 @@ return output.length; } - char[] name() + string name() { return "PBKDF2-"~prf.name; } @@ -120,7 +120,7 @@ { unittest { - static char[][] test_passwords = [ + static string[] test_passwords = [ "password", "password", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"~ @@ -129,7 +129,7 @@ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ]; - static char[][] test_salts = [ + static string[] test_salts = [ "ATHENA.MIT.EDUraeburn", "ATHENA.MIT.EDUraeburn", "pass phrase equals block size", @@ -140,7 +140,7 @@ 1, 1200, 1200, 1200 ]; - static const char[][] test_results = [ + static const string[] test_results = [ "cdedb5281bb2f801565a1122b2563515", "5c08eb61fdf71e4e4ec3cf6ba1f5512b"~ "a7e52ddbc5e5142f708a31e2e62b1e13", @@ -151,12 +151,12 @@ ]; PBKDF2 pbkdf2; - foreach (uint i, char[] p; test_passwords) + foreach (uint i, string p; test_passwords) { pbkdf2 = new PBKDF2(p, test_salts[i], test_iterations[i]); ubyte[] result = new ubyte[test_results[i].length >> 1]; pbkdf2.read(result); - char[] hexResult = ByteConverter.hexEncode(result); + string hexResult = ByteConverter.hexEncode(result); assert(hexResult == test_results[i], pbkdf2.name~": ("~hexResult~") != ("~test_results[i]~")"); } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/crypto/prngs/PRNGFromHash.d --- a/dcrypt/crypto/prngs/PRNGFromHash.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/crypto/prngs/PRNGFromHash.d Sun May 10 22:38:48 2009 -0400 @@ -25,7 +25,7 @@ uint index; } - char[] name() + string name() { if (hash is null) throw new NotInitializedError(name()~": PRNG not initialized"); diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/misc/ByteConverter.d --- a/dcrypt/misc/ByteConverter.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/misc/ByteConverter.d Sun May 10 22:38:48 2009 -0400 @@ -10,7 +10,7 @@ /** Converts between integral types and unsigned byte arrays */ struct ByteConverter { - private static const char[] hexits = "0123456789abcdef"; + private static const string hexits = "0123456789abcdef"; /** Conversions between little endian integrals and bytes */ struct LittleEndian { @@ -128,9 +128,9 @@ } } - static char[] hexEncode(void[] input_) { + static string hexEncode(void[] input_) { ubyte[] input = cast(ubyte[])input_; - char[] output = new char[input.length<<1]; + string output = new char[input.length<<1]; int i = 0; foreach (ubyte j; input) { @@ -140,7 +140,7 @@ return output; } - static ubyte[] hexDecode(char[] input) { + static ubyte[] hexDecode(string input) { ubyte[] output = new ubyte[input.length>>1]; static ubyte[char] hexitIndex; diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/misc/Checksum.d --- a/dcrypt/misc/Checksum.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/misc/Checksum.d Sun May 10 22:38:48 2009 -0400 @@ -22,5 +22,5 @@ uint compute(void[] input_, uint start); /** Returns: The name of the checksum algorithm. */ - char[] name(); + string name(); } \ No newline at end of file diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/misc/checksums/Adler32.d --- a/dcrypt/misc/checksums/Adler32.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/misc/checksums/Adler32.d Sun May 10 22:38:48 2009 -0400 @@ -33,13 +33,13 @@ return (s2 << 16) + s1; } - char[] name() { + string name() { return "Adler32"; } debug (UnitTest) { unittest { - static char[][] test_inputs = [ + static string[] test_inputs = [ "", "a", "checksum", @@ -54,7 +54,7 @@ ]; Adler32 adler32 = new Adler32; - foreach (uint i, char[] j; test_inputs) + foreach (uint i, string j; test_inputs) assert(adler32.compute(j) == test_results[i], adler32.name); } } diff -r 8b5eaf3c2979 -r ad687db713a4 dcrypt/misc/checksums/CRC32.d --- a/dcrypt/misc/checksums/CRC32.d Sat May 09 23:29:20 2009 -0400 +++ b/dcrypt/misc/checksums/CRC32.d Sun May 10 22:38:48 2009 -0400 @@ -77,13 +77,13 @@ return (crc ^ 0xffffffff); } - char[] name() { + string name() { return "CRC32"; } debug (UnitTest) { unittest { - static char[][] test_inputs = [ + static string[] test_inputs = [ "", "a", "checksum", @@ -98,7 +98,7 @@ ]; CRC32 crc32 = new CRC32; - foreach (uint i, char[] j; test_inputs) + foreach (uint i, string j; test_inputs) assert(crc32.compute(j) == test_results[i], crc32.name); } }