# HG changeset patch # User Thomas Dixon # Date 1242162647 14400 # Node ID f429c5e9dd697d8d1942ca642978013720e26ee0 # Parent 21847420b1ac8c2918dc1e5fdfe73128b7e76742 hexDecode in dcrypt.misc.ByteConverter now converts all input to lowercase prior to processing. diff -r 21847420b1ac -r f429c5e9dd69 dcrypt/misc/ByteConverter.d --- a/dcrypt/misc/ByteConverter.d Mon May 11 15:32:00 2009 -0400 +++ b/dcrypt/misc/ByteConverter.d Tue May 12 17:10:47 2009 -0400 @@ -167,6 +167,7 @@ static ubyte[] hexDecode(string input) { + string inputAsLower = stringToLower(input); ubyte[] output = new ubyte[input.length>>1]; static ubyte[char] hexitIndex; @@ -175,10 +176,20 @@ for (int i = 0, j = 0; i < output.length; i++) { - output[i] = hexitIndex[input[j++]] << 4; - output[i] |= hexitIndex[input[j++]]; + output[i] = hexitIndex[inputAsLower[j++]] << 4; + output[i] |= hexitIndex[inputAsLower[j++]]; } return output; } + + private static string stringToLower(string input) + { + char[] output = new char[input.length]; + + foreach (int i, char c; input) + output[i] = ((c >= 'A' && c <= 'Z') ? c+32 : c); + + return cast(string)output; + } }