473,765 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Thank you,
MuZZy
Jan 27 '06 #1
3 6505
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
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.GetHashc ode?

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

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

3
1640
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;
7
6576
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++
8
9907
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...
19
3843
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 handles GetHashCode and Equal? If so, is such a wrapper present in the standard class library?
5
2284
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();
6
2261
by: Jayender | last post by:
Hi, What is the difference between Hashing and Encryption ?
5
2153
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 purchase in a given period of time. Would hashing card numbers and then storing and comparing hashes...
4
392
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 hash.GetHashCode();
28
3787
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?
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10156
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9951
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.