Hello murmurhash-net

I just completed my implementation of the MurmurHash 3 algorithm to .NET and you can find it on GitHub. MurmurHash is a non-crpytographic hash that has good speed and distribution characteristics.

When to use MurmurHash

Now, I need to stress again that MurmurHash is not a cryptographic hash algorithm. You should not use MurmurHash someplace where collisions can cause a denial of service scenario or where you are trying to keep the hashed value a secret. However, there are likely many places you could leverage a hash algorithm where neither of those apply.

So, why use MurmurHash instead of SHA1 or MD5 or something similar? Well, primarily because it's fast. Realistically you should see MurmurHash being between 4x and 10x faster than SHA1 or MD5. While you may not be hashing millions of items in a batch, that was actually the situation we found ourselves in.

MurmurHash comes in two variants: 32-bit and 128-bit. Depending on what you are doing, another reason to use MurmurHash could be the fact that it's smaller than most other comparable algorithms. Being the same size as MD5, you should consider using MurmurHash anywhere you might consider using MD5.

Other thoughts

I haven't decided if it's a clever idea or a stupid idea, but since the larger MurmurHash variant returns a 128-bit value, you can easily create a Guid from it. It is a bit more convenient to work with a Guid rather than an array of bytes so I actually think it could be a good idea. On the other hand, people expect Guid's to be unique so it could be very surprising when two different items hash to the same value.

So if you have need for a fast hash algorithm that doesn't need to be secure, give MurmurHash a try. You can also find the code on NuGet in unsigned and signed packages