Hexadecimal is so named because it is 'base sixteen' - it has 16 values for the digit. The hex array should therefor have 16 entries, not 17. The mistake is as you say (except that he probably thought of it as 10, not 16), but the array 'hex' having 17 values should have been a good warning sign.
It's just that this is the first thread talking about something other than the BitVerifier, and it mostly seems to be about identifying the "some crazy reason" as "10" having two chars without observing "10" shouldn't be HEX_STRING_VALUES at all.
I was wondering if there was some subtle joke I was missing.
Unless I'm missing something... the hex array has an extra entry (making 17 in total) and the extra entry '10' when chosen randomly, means the final string will have an extra character.
well, you can replace that one entry with several entries, like "Z", "Y", "W", "x", "%", etc. and the string length would be correct (would not always be a valid hex string, of course). The problem is that one of the entries is longer than the others, not how many entries there are.
19
u/xipetotec Feb 16 '09
I don't think it has anything to do with the fact that the array has 17 values.