https://github.com/jitbit/murmurhash.net
C# .NET implementation of Murmur Hash
https://github.com/jitbit/murmurhash.net
csharp dotnet hash murmur murmurhash murmurhash2 net
Last synced: 7 months ago
JSON representation
C# .NET implementation of Murmur Hash
- Host: GitHub
- URL: https://github.com/jitbit/murmurhash.net
- Owner: jitbit
- License: mit
- Created: 2017-03-11T23:31:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T21:40:13.000Z (over 7 years ago)
- Last Synced: 2025-03-01T15:11:20.284Z (7 months ago)
- Topics: csharp, dotnet, hash, murmur, murmurhash, murmurhash2, net
- Language: C#
- Homepage: https://www.jitbit.com
- Size: 7.81 KB
- Stars: 19
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MurmurHash .NET
C# implementation of Murmur Hash 2Usage:
```
MurmurHash2.Hash("mystring");
MurmurHash2.Hash(byteArray);
```I wrote a small benchmark to test the number of collisions on a 466k words (list of all English words taken from here: https://github.com/dwyl/english-words) and **the number of collisions is 22** which I consider a pretty good result.
Standard `string.GetHashCode()` gives **48 collisions** on the 466k word list.
Elapsed time (on the 466k word list):
| Hash | Elapsed time | # of collisions |
| --- | --- | --- |
| MurmurHash2 | 104 ms | 22 |
| GetHashCode | 47 ms | 48 |On the numbers from `1` to `999999` (think ZIP codes) the results were:
| Hash | Elapsed time | # of collisions |
| --- | --- | --- |
| MurmurHash2 | 234 ms | 56 |
| GetHashCode | 121 ms | 0 |`GetHashCode` is better with collisions here, but MurMur shines on longer texts.