murmur3a

Package Version Hex Docs

A pure Gleam implementation of the 32bit Murmur3 non-cryptographic hash function (with a little JavaScript optimisation).

gleam add murmur3a
import gleam/io
import murmur3a

pub fn main() {
  murmur3a.hash_string("Hello!", 1)
  |> murmur3a.hex_digest
  // -> "DC75D641"
}

API documentation can be found at https://hexdocs.pm/murmur3a.

Development

gleam test                      # Run the tests with erlang
gleam test --target javascript  # Run the tests with bun

Credits

murmur3a leans heavily on Robin Heggelund Hansen’s Elm implementation.

Search Document