Murmur - a pure Elixir implementation of the non-cryptographic hash Murmur3

Murmur is a pure Elixir implementation of the non-cryptographic hash Murmur3.

It aims to implement the x86_32bit, x86_128bit and x64_128bit variants.

Usage

Add Murmur as a dependency in your mix.exs file.

def deps do [{:murmur, "~> 2.0"}] end

Examples

iex> Murmur.hash_x86_32("b2622f5e1310a0aa14b7f957fe4246fa", 2147368987)
3297211900

iex> Murmur.hash_x86_128("some random data")
5586633072055552000169173700229798482

# hashes of Erlang terms may change between Erlang versions
iex> Murmur.hash_x64_128([:yes, :you, :can, :use, :any, :erlang, :term!])
300414073828138369336317731503972665325
8 Likes

Dear Community,

Quick heads up about the Murmur hashing library:

  1. I’ve taken over maintenance from original author @gmcabrita who was very kind and fast to respond.
  2. @szetty discovered 128-bit hashes weren’t consistent with the original implementation.
  3. @szetty fixed this and we released v2.0.
  4. This is a breaking change - the library now produces different 128bit hashes, 32bit hashes are the same as before.

If you’re using this library, please be aware of this change when upgrading.

2 Likes