473,561 Members | 3,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MD5 hashing vs GetHashcode


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

Thank you,
Jan 27 '06 #1
3 6487
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.MD 5 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.GetHashc ode 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
"MuZZy" wrote:

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

Thank you,

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.GetHashC ode
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

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

Dale Preston
"MuZZy" wrote:

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

Thank you,

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.GetHashc ode?

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

Jon Skeet - <sk***@pobox.co m>
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Farouche | last post by:
Hi I would like some suggestions on how to, effectively compute a Hash Value for a "Collection" of simple Field Objects: internal class Field { private string _fieldName; private object _fieldValue;
by: Avin Patel | last post by:
Hi I have question for GetHashCode() function, Is it correct in following code or there is more efficient way to implement GetHashCode() function class IntArray public int data public override int GetHashCode() int hash = 0 for (int i = 0; i < data.Length; i++
by: Matthias Kientz | last post by:
I have a class which should override the GetHashcode() function, which look like this: public class A { public string str1; public string str2; //other methods...
by: Ole Nielsby | last post by:
How does the GetHashCode() of an array object behave? Does it combine the GetHashCode() of its elements, or does it create a sync block for the object? I want to use readonly arrays as dictionary keys, based on their content, not their identity. Is this feasible using the arrays directly, or do I need to wrap them in a struct that...
by: Metaman | last post by:
I'm trying to write a generic method to generate Hashcodes but am having some problems with (generic) collections. Here is the code of my method: public static int GetHashCode(object input) { try { Type objectType = input.GetType(); PropertyInfo properties = objectType.GetProperties();
by: Jayender | last post by:
Hi, What is the difference between Hashing and Encryption ?
by: Andrew Robinson | last post by:
I am working on a pretty simple e-commerce web site that will sell our company gift cards online. Our company and merchant policy prohibits us from storing credit card numbers in any way once we clear the transaction using Pay Flow. To help protect against fraud, I would like to know when the same card number is used to make more than one...
by: Andrew Robinson | last post by:
I have a class that has three properties: two of type int and one of type string. Is this the best method when overriding the GetHashCode() ? I am guessing not... any thing better? public override int GetHashCode() { string hash = craneCounterweightID.ToString() + ":" + trailerID.ToString() + ":" + craneConfigurationTypeCode; return...
by: Tony Johansson | last post by:
Hello! I can't figure out what point it is to use GetHashCode. I know that this GetHashCode is used for obtaining a unique integer value. Can somebody give me an example that prove the usefulness of this GetHashCode or it it of no use at all? A mean that if I get an integer from current time in some way what should I use it for?
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.