mmh3
mmh3: A Python extension for MurmurHash3 - Published in JOSS (2025)
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
Keywords from Contributors
Repository
Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions.
Basic Info
- Host: GitHub
- Owner: hajimes
- License: mit
- Language: C
- Default Branch: master
- Homepage: https://pypi.org/project/mmh3/
- Size: 3.48 MB
Statistics
- Stars: 349
- Watchers: 8
- Forks: 73
- Open Issues: 4
- Releases: 18
Topics
Metadata Files
README.md
mmh3
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
- Improve the performance of
hash128(),hash64(), andhash_bytes()by using METH_FASTCALL, reducing the overhead of function calls (#116). - Add the software paper for this library (doi:10.21105/joss.06124), following its publication in the Journal of Open Source Software (#118).
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.
- Chapter 11: Using Less Ram in Micha Gorelick and Ian Ozsvald. 2014. High
Performance Python: Practical Performant Programming for Humans. O'Reilly
Media. ISBN: 978-1-4493-6159-4.
- 2nd edition of the above (2020). ISBN: 978-1492055020.
- Max Burstein. February 2, 2013. Creating a Simple Bloom Filter.
- Duke University. April 14, 2016. [Efficient storage of data in memory](http://people.duke.edu/~ccc14/sta-663-2016/20BBigDataStructures.html)_.
- Bugra Akyildiz. August 24, 2016. A Gentle Introduction to Bloom Filter. KDnuggets.
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.
- Jan Kopriva. April 19, 2021. Hunting phishing websites with favicon hashes. SANS Internet Storm Center.
- Nikhil Panwar. May 2, 2022. Using Favicons to Discover Phishing & Brand Impersonation Websites. Bolster.
- Faradaysec. July 25, 2022. Understanding Spring4Shell: How used is it?. Faraday Security.
- Debjeet. August 2, 2022. How To Find Assets Using Favicon Hashes. Payatu.
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
- https://github.com/wc-duck/pymmh3: mmh3 in pure python (Fredrik Kihlander and Swapnil Gusani)
- https://github.com/escherba/python-cityhash: Python bindings for CityHash (Eugene Scherba)
- https://github.com/veelion/python-farmhash: Python bindings for FarmHash (Veelion Chong)
- https://github.com/escherba/python-metrohash: Python bindings for MetroHash (Eugene Scherba)
- https://github.com/ifduyue/python-xxhash: Python bindings for xxHash (Yue Du)
Owner
- Name: Hajime Senuma
- Login: hajimes
- Kind: user
- Location: Japan
- Company: University of Tokyo
- Repositories: 6
- Profile: https://github.com/hajimes
JOSS Publication
mmh3: A Python extension for MurmurHash3
Tags
hash high-performance computing artificial intelligence natural language processing internet of things cybersecurityGitHub 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
Top Committers
| Name | 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
Pull Request Labels
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
Rankings
Maintainers (1)
proxy.golang.org: github.com/hajimes/mmh3
- Documentation: https://pkg.go.dev/github.com/hajimes/mmh3#section-documentation
- License: mit
-
Latest release: v5.2.0+incompatible
published 5 months ago
Rankings
alpine-edge: py3-mmh3-doc
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-edge: py3-mmh3
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
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.
- Homepage: https://github.com/hajimes/mmh3
- License: MIT
-
Latest release: 5.0.1
published 12 months ago
Rankings
alpine-v3.21: py3-mmh3
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.22: py3-mmh3
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.21: py3-mmh3-doc
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.19: py3-mmh3
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r1
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-mmh3-doc
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-mmh3
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.19: py3-mmh3-doc
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r1
published about 2 years ago
Rankings
alpine-v3.20: py3-mmh3-doc
Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions (documentation)
- Homepage: https://github.com/hajimes/mmh3
- License: CC0-1.0
-
Latest release: 4.0.1-r2
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- github/super-linter v3 composite
- 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
