
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
Thanks Jon...that explains why I get different numbers when generating hashes
outside of .NET. I thought the 2.0 algorithm had changed.
> > Within a native C++ app , I need to be able to generate a hash for a given
> > string that matches the hash that the same string returns from the .NET 1.1
[quoted text clipped - 6 lines]
> *not* be persisted (which is presumably what has happened here) unless
> you have clear documentation saying that this is valid.
Michael Nemtsev - 19 Jul 2006 19:25 GMT
Hello ALV,
U hardly get them both the same, and there is no reason to look at .net realization.
Everything depends on you data. Hash algorithm should be tuned to your specific
data to get the most rage of data distribution
I'd recomend to read Donald E. Knuth books about it, smth like "golden cut
set of data distribution" and etc.
A> Thanks Jon...that explains why I get different numbers when
A> generating hashes outside of .NET. I thought the 2.0 algorithm had
A> changed.
A>
A> "Jon Skeet [C# MVP]" wrote:
A>
>>> Within a native C++ app , I need to be able to generate a hash for a
>>> given string that matches the hash that the same string returns from
[quoted text clipped - 12 lines]
>> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
>> If replying to the group, please do not mail me too
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
Jon Skeet [C# MVP] - 19 Jul 2006 20:48 GMT
> Thanks Jon...that explains why I get different numbers when generating hashes
> outside of .NET. I thought the 2.0 algorithm had changed.
It *has* changed in .NET 2.0 - and it may well change again. Further,
it shouldn't break anything if the runtime decided to take a random
number when it started, and added that to the result of every call to
String.GetHashCode: the value is crucial *within* that run of an
application, but shouldn't be taken to be useful for different runs,
even with the same framework version.

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