is there a open source c# library with a gethashcode equivalent which is even faster than gethashcode()? in csharp

There are a few open source hashing libraries available for C# which purport to be faster than the inbuilt GetHashCode() method. One such library is MurmurHash. Here's how to use it:

First, install the MurmurHash NuGet package.

main.cs
Install-Package MurmurHash
27 chars
2 lines

Next, add a using statement for the MurmurHash namespace.

main.cs
using MurmurHash;
18 chars
2 lines

Finally, use the MurmurHash algorithm like this:

main.cs
string input = "some string to hash";
int seed = 0; // your choice of seed value
int hash = MurmurHash3.Hash32(input, seed);
125 chars
4 lines

MurmurHash is available under the MIT license.

related categories

gistlibby LogSnag