mmh3

mmh3: A Python extension for MurmurHash3 - Published in JOSS (2025)

https://github.com/hajimes/mmh3

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 14 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

cpython hash murmurhash murmurhash3 python

Keywords from Contributors

turing-machine standardization pde mesh parallel interpretability evolutionary-algorithms ode pypi simulations
Last synced: 4 months ago · JSON representation

Repository

Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions.

Basic Info
Statistics
  • Stars: 349
  • Watchers: 8
  • Forks: 73
  • Open Issues: 4
  • Releases: 18
Topics
cpython hash murmurhash murmurhash3 python
Created almost 13 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

mmh3

Documentation Status GitHub Super-Linter Build PyPi Version Python Versions License: MIT Total Downloads Recent Downloads DOI

mmh3 is a Python extension for MurmurHash (MurmurHash3), a set of fast and robust non-cryptographic hash functions invented by Austin Appleby.

By combining mmh3 with probabilistic techniques like Bloom filter, MinHash, and feature hashing, you can develop high-performance systems in fields such as data mining, machine learning, and natural language processing.

Another popular use of mmh3 is to calculate favicon hashes, which are utilized by Shodan, the world's first IoT search engine.

This page provides a quick start guide. For more comprehensive information, please refer to the documentation.

Installation

shell pip install mmh3

Usage

Basic usage

```pycon

import mmh3 mmh3.hash(b"foo") # returns a 32-bit signed int -156908512 mmh3.hash("foo") # accepts str (UTF-8 encoded) -156908512 mmh3.hash(b"foo", 42) # uses 42 as the seed -1322301282 mmh3.hash(b"foo", 0, False) # returns a 32-bit unsigned int 4138058784 ```

mmh3.mmh3_x64_128_digest(), introduced in version 5.0.0, efficienlty hashes buffer objects that implement the buffer protocol (PEP 688) without internal memory copying. The function returns a bytes object of 16 bytes (128 bits). It is particularly suited for hashing large memory views, such as bytearray, memoryview, and numpy.ndarray, and performs faster than the 32-bit variants like hash() on 64-bit machines.

```pycon

mmh3.mmh3x64128_digest(numpy.random.rand(100)) b'\x8c\xee\xc6z\xa9\xfeR\xe8o\x9a\x9b\x17u\xbe\xdc\xee' ```

Various alternatives are available, offering different return types (e.g., signed integers, tuples of unsigned integers) and optimized for different architectures. For a comprehensive list of functions, refer to the API Reference.

hashlib-style hashers

mmh3 implements hasher objects with interfaces similar to those in hashlib from the standard library, although they are still experimental. See Hasher Classes in the API Reference for more information.

Changelog

See Changelog (latest version) for the complete changelog.

5.2.0 - 2025-07-29

Added

  • Add support for Python 3.14, including 3.14t (no-GIL) wheels. However, thread safety for the no-GIL variant is not fully tested yet. Please report any issues you encounter (#134, #136).
  • Add support for Android (Python 3.13 only) and iOS (Python 3.13 and 3.14) wheels, enabled by the major version update of cibuildwheel (#135).

5.1.0 - 2025-01-25

Added

Removed

  • Drop support for Python 3.8, as it has reached the end of life on 2024-10-07 (#117).

5.0.1 - 2024-09-22

Fixed

  • Fix the issue that the package cannot be built from the source distribution (#90).

License

MIT, unless otherwise noted within a file.

Frequently Asked Questions

Different results from other MurmurHash3-based libraries

By default, mmh3 returns signed values for the 32-bit and 64-bit versions and unsigned values for hash128 due to historical reasons. To get the desired result, use the signed keyword argument.

Starting from version 4.0.0, mmh3 is endian-neutral, meaning that its hash functions return the same values on big-endian platforms as they do on little-endian ones. In contrast, the original C++ library by Appleby is endian-sensitive. If you need results that comply with the original library on big-endian systems, please use version 3.*.

For compatibility with Google Guava (Java), see https://stackoverflow.com/questions/29932956/murmur3-hash-different-result-between-python-and-java-implementation.

For compatibility with murmur3 (Go), see https://github.com/hajimes/mmh3/issues/46.

Handling errors with negative seeds

From the version 5.0.0, mmh3 functions accept only unsigned 32-bit integer seeds to enable faster type-checking and conversion. However, this change may cause issues if you need to calculate hash values using negative seeds within the range of signed 32-bit integers. For instance, Telegram-iOS uses -137723950 as a hard-coded seed (bitwise equivalent to 4157243346). To handle such cases, you can convert a signed 32-bit integer to its unsigned equivalent by applying a bitwise AND operation with 0xffffffff. Here's an example:

```pycon

mmh3.hash(b"quux", 4294967295) 258499980 d = -1 mmh3.hash(b"quux", d & 0xffffffff) 258499980 ```

Alternatively, if the seed is hard-coded (as in the Telegram-iOS case), you can precompute the unsigned value for simplicity.

Contributing Guidelines

See Contributing.

Authors

MurmurHash3 was originally developed by Austin Appleby and distributed under public domain https://github.com/aappleby/smhasher.

Ported and modified for Python by Hajime Senuma.

External Tutorials

High-performance computing

The following textbooks and tutorials are great resources for learning how to use mmh3 (and other hash algorithms in general) for high-performance computing.

Internet of things

Shodan, the world's first IoT search engine, uses MurmurHash3 hash values for favicons (icons associated with web pages). ZoomEye follows Shodan's convention. Calculating these values with mmh3 is useful for OSINT and cybersecurity activities.

How to Cite This Library

If you use this library in your research, it would be appreciated if you could cite the following paper published in the Journal of Open Source Software:

Hajime Senuma. 2025. mmh3: A Python extension for MurmurHash3. Journal of Open Source Software, 10(105):6124.

In BibTeX format:

tex @article{senumaMmh3PythonExtension2025, title = {{mmh3}: A {Python} extension for {MurmurHash3}}, author = {Senuma, Hajime}, year = {2025}, month = jan, journal = {Journal of Open Source Software}, volume = {10}, number = {105}, pages = {6124}, issn = {2475-9066}, doi = {10.21105/joss.06124}, copyright = {http://creativecommons.org/licenses/by/4.0/} }

Related Libraries

Owner

  • Name: Hajime Senuma
  • Login: hajimes
  • Kind: user
  • Location: Japan
  • Company: University of Tokyo

JOSS Publication

mmh3: A Python extension for MurmurHash3
Published
January 18, 2025
Volume 10, Issue 105, Page 6124
Authors
Hajime Senuma ORCID
National Institute of Informatics, Japan
Editor
Vincent Knight ORCID
Tags
hash high-performance computing artificial intelligence natural language processing internet of things cybersecurity

GitHub Events

Total
  • Create event: 35
  • Release event: 3
  • Issues event: 3
  • Watch event: 23
  • Delete event: 36
  • Issue comment event: 19
  • Push event: 54
  • Pull request event: 72
  • Fork event: 4
Last Year
  • Create event: 35
  • Release event: 3
  • Issues event: 3
  • Watch event: 23
  • Delete event: 36
  • Issue comment event: 19
  • Push event: 54
  • Pull request event: 72
  • Fork event: 4

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 285
  • Total Committers: 14
  • Avg Commits per committer: 20.357
  • Development Distribution Score (DDS): 0.123
Past Year
  • Commits: 112
  • Committers: 4
  • Avg Commits per committer: 28.0
  • Development Distribution Score (DDS): 0.196
Top Committers
Name Email Commits
Hajime Senuma h****a@g****m 250
dependabot[bot] 4****] 20
Matthew Honnibal h****h@g****m 2
Micha Gorelick m****a@b****y 2
Derek Wilson d****n@d****m 2
wouter bolsterlee w****r@b****e 1
pik a****v@g****m 1
n-dusan n****y@g****m 1
arieleizenberg 9****g 1
Vince Knight v****e@v****g 1
Danil Shein d****n@a****g 1
Daniel S. Katz d****z@i****g 1
Craig Andrews c****g@l****k 1
Dimitri Vorona v****a@i****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 48
  • Total pull requests: 103
  • Average time to close issues: 9 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 34
  • Total pull request authors: 16
  • Average comments per issue: 1.88
  • Average comments per pull request: 0.6
  • Merged pull requests: 60
  • Bot issues: 0
  • Bot pull requests: 57
Past Year
  • Issues: 5
  • Pull requests: 82
  • Average time to close issues: 9 days
  • Average time to close pull requests: 3 days
  • Issue authors: 5
  • Pull request authors: 4
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.45
  • Merged pull requests: 42
  • Bot issues: 0
  • Bot pull requests: 50
Top Authors
Issue Authors
  • hajimes (13)
  • WrenchKing (2)
  • dan-blanchard (2)
  • sourabhQA (1)
  • mkoistinen (1)
  • pitrou (1)
  • edevil (1)
  • yzssbo (1)
  • niklassemmler (1)
  • ZhuYuanchen (1)
  • matejsp (1)
  • milahu (1)
  • varunkumar (1)
  • tcmitchell (1)
  • VendorAttestation (1)
Pull Request Authors
  • dependabot[bot] (87)
  • hajimes (39)
  • underrun (2)
  • drvinceknight (2)
  • danielskatz (2)
  • wbolster (1)
  • n-dusan (1)
  • honnibal (1)
  • dshein-alt (1)
  • brainix (1)
  • pik (1)
  • mynameisfiber (1)
  • arieleizenberg (1)
  • doozr (1)
  • alendit (1)
Top Labels
Issue Labels
enhancement (7) bug (2) documentation (1)
Pull Request Labels
dependencies (86) python (65) github_actions (17)

Packages

  • Total packages: 13
  • Total downloads:
    • pypi 15,618,725 last-month
  • Total docker downloads: 257,066,770
  • Total dependent packages: 152
    (may contain duplicates)
  • Total dependent repositories: 1,827
    (may contain duplicates)
  • Total versions: 51
  • Total maintainers: 2
pypi.org: mmh3

Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions.

  • Homepage: https://pypi.org/project/mmh3/
  • Documentation: https://mmh3.readthedocs.io/
  • License: MIT License Copyright (c) 2011-2025 Hajime Senuma Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 5.2.0
    published 5 months ago
  • Versions: 16
  • Dependent Packages: 152
  • Dependent Repositories: 1,823
  • Downloads: 15,618,725 Last month
  • Docker Downloads: 257,066,770
Rankings
Downloads: 0.2%
Dependent packages count: 0.2%
Dependent repos count: 0.3%
Docker downloads count: 0.5%
Average: 1.7%
Stargazers count: 3.7%
Forks count: 5.2%
Maintainers (1)
Last synced: 4 months ago
proxy.golang.org: github.com/hajimes/mmh3
  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 3.3%
Stargazers count: 3.5%
Average: 4.5%
Dependent packages count: 5.4%
Dependent repos count: 5.7%
Last synced: 4 months ago
alpine-edge: py3-mmh3-doc

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 11.3%
Forks count: 14.4%
Dependent packages count: 14.6%
Stargazers count: 16.2%
Maintainers (1)
Last synced: 4 months ago
alpine-edge: py3-mmh3

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 11.3%
Forks count: 14.4%
Dependent packages count: 14.6%
Stargazers count: 16.2%
Maintainers (1)
Last synced: 4 months ago
anaconda.org: mmh3

mmh3 is a Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust non-cryptographic hash functions invented by Austin Appleby.

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 4
Rankings
Forks count: 34.3%
Stargazers count: 36.5%
Average: 41.6%
Dependent repos count: 44.5%
Dependent packages count: 51.0%
Last synced: 4 months ago
alpine-v3.21: py3-mmh3

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.22: py3-mmh3

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.21: py3-mmh3-doc

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.19: py3-mmh3

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.22: py3-mmh3-doc

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.20: py3-mmh3

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago
alpine-v3.19: py3-mmh3-doc

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 4 months ago
alpine-v3.20: py3-mmh3-doc

Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/build-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/superlinter.yml actions
  • actions/checkout v2 composite
  • github/super-linter v3 composite
.github/workflows/wheels.yml actions
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
  • docker/setup-qemu-action v1.0.1 composite
  • joerick/cibuildwheel v1.9.0 composite