Is there a .Net 1.1 compatible String.GetHashCode implemented in .NET 2.0 code?

I have an existing application in which I made a mistake using String.GetHashCode and saving it to disk. Now, when I upgrade the application to .Net 2.0, I find that this solution has returned to bite me in the butt.

I am interested to know if anyone knows about the .NET implementation of the .NET compatible string hashing algorithm.

Obviously, the best solution would be to buy a time machine and go back to 2002, as well as hit yourself in the shin even to use the hash code in this way. Since this does not seem likely, I am looking for a workaround. I have existing users with this data in my systems, so I am not able to do one big hash conversion or something like that.

When changing to 2.0, I will update the code so that of course it uses MD5 or SHA.

I considered extracting the String.GetHashCode source from Mono, but since Mono is the GPL and my application is commercial, this is really not an option. I don’t even know if the Mono implementation is compatible with the MS.Net implementation, since the contract for GetHashCode does not require it to be compatible.

Any ideas?

+3
source share
1 answer

You're not the only one it seems: Getting the .NET 1.1 CLR String Hash Codes in the .NET 2.0 CLR

Link to BackCompatibleStringComparer , which (supposedly, I can not check) shows the implementation of the old GetHashCode().

+6
source

Source: https://habr.com/ru/post/1726837/


All Articles