Sunday, July 24, 2011

Port of Murmur3 hash to C

Murmur3 is a non-cryptographic hash function, stupendously fast, with excellent mathematical properties. It's just the thing to use if you want to make a hash table, or a Bloom filter, or do any number of other things that require fast, high-quality hashing. Unfortunately, the original code was in C++ and designed mostly for Microsoft Visual Studio, making it not the tool of choice for those of us who would prefer C code, compiled with gcc or something similar. So I ported the code to C and cleared out the MSVC-specific parts.


It's public domain, so do whatever you want with it. There's just a single C file and a short header file, so it should be really easy to incorporate into your own projects. See the readme file on GitHub for more details, or the example program to see how it's used.

Happy hashing!

2 comments: