hey guys thanks for the clarification. i'll have to keep the code
operational because i can't re-encode the passwords with a correct
algorithm, without knowing the passwords.
jon i suppose you mean 'arbitrary' in a technical sense that i'm not aware
of. since it's MD5 it always returns an identical hash of a given string.
according to the SDK, UTF8Encoding.GetString "Decodes a sequence of bytes
into a string", which is what i want, and it has worked correctly for years
except for this new platform difference between Vista and previous windows
versions.
i have another version of the code which yields Hex digits, and is obviously
much safer to use but i'll have to live with the current setup.
thanks again for your help,
tim
> hey guys thanks for the clarification. i'll have to keep the code
> operational because i can't re-encode the passwords with a correct
> algorithm, without knowing the passwords.
>
> jon i suppose you mean 'arbitrary' in a technical sense that i'm not aware
> of.
I mean that it's binary data with no significance as far as the UTF-8
encoding is concerned. It could be *any* binary data. Not every
sequence of binary data is a valid UTF-8 string.
> since it's MD5 it always returns an identical hash of a given string.
> according to the SDK, UTF8Encoding.GetString "Decodes a sequence of bytes
> into a string", which is what i want, and it has worked correctly for years
> except for this new platform difference between Vista and previous windows
> versions.
It didn't work "correctly". It may have done something repeatable when
presented with a sequence of bytes which was not a valid UTF-8 encoded
string, but I don't believe that behaviour was documented, and I don't
think it's unreasonable to change it in Vista.
It's like relying on the results of GetHashcode from one framework
version (or even one run) to another, or accessing the UI from a
different thread: you may get away with it for a while, but that
doesn't mean the code is correct, or that you should rely on it working
in the future.
> i have another version of the code which yields Hex digits, and is obviously
> much safer to use but i'll have to live with the current setup.
I would start migrating code away from the flawed behaviour ASAP, if I
were you. You may need to support two formats or something like that
for a while, but relying on *just* the band-aid could well cause more
problems down the line.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Tim_Mac - 07 Oct 2006 23:48 GMT
hi jon,
you're absolutely right. i can implement a correct solution in parallel and
add it in to a second password column in the database. eventually everyone
will have logged in to the site and i can disband the old code and badly
hashed passwords.
thanks for the convincing argument!
tim
>> hey guys thanks for the clarification. i'll have to keep the code
>> operational because i can't re-encode the passwords with a correct
[quoted text clipped - 35 lines]
> for a while, but relying on *just* the band-aid could well cause more
> problems down the line.