MD5 hashing vs GetHashcode

  • Thread starter Thread starter MuZZy
  • Start date Start date
M

MuZZy

Hi,

Is there any guarantee that MD5 hashing algorithm implementation will
not change in the next .NET version unlike what's happened to
String.GetHashcode?

Thank you,
MuZZy
 
What exactly are you asking or implying? Since the results of GetHashcode
shouldn't be persisted - it is only intended for equality comparisons - then
it shoudln't matter if the results change.

GetHashCode is also not intended to provide security for data.

I'll admit I have never tried to compare the hash results between versions
of the .Net framework but if you're implying that the results of
Cryptography.MD5 is different between versions of the .Net framework, then
Microsoft has a problem.

The fact is, though, that there's nothing in the documentation of
String.GetHashcode that says it is MD5. In fact, it says specifically:

"The behavior of GetHashCode is dependent on its implementation, which might
change from one version of the common language runtime to another. A reason
why this might happen is to improve the performance of GetHashCode. If you
require the behavior of GetHashCode be constant, override the runtime
implementation of GetHashCode with an implementation of your own that you
know will never change."

So the short answer to your question is, "No, there is no guarantee."
 
Read my reply to your earlier post. I wrote my first reply here before
seeing your other post. After reading that one, I better understood what you
were asking. As I stated there, MD5, and others such as the SHA series of
hash algorithms, are true cryptographic hashes and, other than fixing flaws
in the implementations, should remain consistent over versions.

And as I stated in the first reply to this post, the string.GetHashCode
documentation for version 1.1 specifically states there is no guarantee of
compatability between versions of GetHashCode.

I feel for ya, buddy. When I saw your post about a HUGE problem with
hashcodes, my first reaction was, "How could someone have a huge problem with
hashcodes?"

You are right though. You have a huge problem with hashcodes :). Good luck
with it though.

Dale Preston
MCAD C#
MCSE, MCDBA
 
MuZZy said:
Is there any guarantee that MD5 hashing algorithm implementation will
not change in the next .NET version unlike what's happened to
String.GetHashcode?

No, the implementation could change. The *results* won't, however, as
they're specified (unlike String.GetHashcode).
 
Back
Top