471,325 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

MD5 hashing vs GetHashcode

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
Jan 27 '06 #1
3 6056
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."

--
Dale Preston
MCAD C#
MCSE, MCDBA
"MuZZy" wrote:
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

Jan 27 '06 #2
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" wrote:
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

Jan 27 '06 #3
MuZZy <tn*@newsgroups.nospam> wrote:
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).

--
Jon Skeet - <sk***@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
Jan 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Farouche | last post: by
7 posts views Thread by Avin Patel | last post: by
8 posts views Thread by Matthias Kientz | last post: by
19 posts views Thread by Ole Nielsby | last post: by
5 posts views Thread by Metaman | last post: by
6 posts views Thread by Jayender | last post: by
5 posts views Thread by Andrew Robinson | last post: by
4 posts views Thread by Andrew Robinson | last post: by
28 posts views Thread by Tony Johansson | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.