murmurhash

Cython bindings for the fast, non-cryptographic MurmurHash2 hashing algorithm

Library
PyPI
v1.0.15
47stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
31/100Needs Attention
Development Activity8
Maintenance20
Community24
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture72
Code Quality75
Innovation55
Learning Curve68

murmurhash exposes the MurmurHash2 algorithm to Python through thin Cython bindings around the original C++ implementation, giving near-native hashing speed for use cases like feature hashing, string interning, and hash-table keys where cryptographic strength isn’t needed but throughput is. It’s a small, dependency-light package maintained by Explosion as low-level infrastructure for spaCy and Thinc.

What You Get

  • Python-callable murmurhash.hash()/hash_unicode()/hash_bytes() functions wrapping MurmurHash2
  • A .pxd Cython header exposing the raw C++ functions for zero-overhead calls from other Cython code
  • Deterministic, seedable hashing suitable for consistent hash-table keys across runs
  • Prebuilt wheels distributed via explosion/wheelwright so no C++ toolchain is needed to install

Common Use Cases

  • Hashing vocabulary strings to fixed-size integer IDs in NLP pipelines (spaCy’s StringStore)
  • Feature hashing in ML pipelines where a large feature space is mapped into a fixed-size hash space
  • Fast, consistent string-to-int keys for custom hash tables in performance-critical Cython code
  • Any workload needing a fast non-cryptographic hash rather than SHA-family cryptographic hashes

Under The Hood

Architecture: the package is a thin Cython wrapper (murmurhash/mrmr.pyx) around a bundled C++ MurmurHash2 implementation in include/, exposing both a Python-facing module and a .pxd header so other Cython packages (like spaCy) can call the hash function directly at the C level with zero Python overhead. Tech Stack: C++ core with Cython bindings, built via setup.py/pyproject.toml, distributed as prebuilt wheels through explosion/wheelwright to avoid requiring end users to compile C++. Code Quality: the codebase is intentionally minimal — a single .pyx binding file plus the vendored MurmurHash2 C++ source — which keeps its surface easy to audit, though the project sees infrequent updates given the algorithm itself is stable and essentially feature-complete. API Design: the API mirrors the underlying C function signatures closely (seed, length, output type), prioritizing raw call-site performance for library authors over ergonomic conveniences aimed at typical application code.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search