Murmurhash2

0.2.10 · maintenance · verified Wed Apr 15

Murmurhash2 is a Python library providing fast, non-cryptographic hash functions, specifically bindings for the MurmurHash2 and MurmurHash3 algorithms. It is designed for high performance in applications such as hash tables, caching, and data distribution, rather than for security-sensitive use cases. The current version, 0.2.10, was last released in February 2022 and supports Python 3.6+ environments. The project appears to be in a maintenance status with infrequent updates.

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use both `murmurhash2` and `murmurhash3` functions. Input data must be provided as bytes.

from murmurhash2 import murmurhash2, murmurhash3

SEED = 3242157231  # A common seed value, can be any integer
data_to_hash = b'Hello, MurmurHash!' # Input must be bytes

hash_value_2 = murmurhash2(data_to_hash, SEED)
hash_value_3 = murmurhash3(data_to_hash, SEED)

print(f"MurmurHash2 of '{data_to_hash.decode()}' with seed {SEED}: {hash_value_2}")
print(f"MurmurHash3 of '{data_to_hash.decode()}' with seed {SEED}: {hash_value_3}")

view raw JSON →