Skip to main content

mmh3

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

mmh3 2.3.1 supports both Python 2.7 and 3.x.

Usage

Sample Usage:

>>> import mmh3
>>> mmh3.hash('foo') # 32 bit signed int
-156908512
>>> mmh3.hash64('foo') # two 64 bit signed ints
(-2129773440516405919, 9128664383759220103)
>>> mmh3.hash128('foo') # 128 bit signed int
168394135621993849475852668931176482145
>>> mmh3.hash_bytes('foo') # 128 bit value as bytes
'aE\xf5\x01W\x86q\xe2\x87}\xba+\xe4\x87\xaf~'
>>> mmh3.hash('foo', 42) # uses 42 for its seed
-1322301282

hash64, hash128, and hash_bytes have the third argument for architecture optimization. Use True for x64 and False for x86 (default: True).:

>>> mmh3.hash64('foo', 42, True)
(-840311307571801102, -6739155424061121879)

Changes

2.3.1 (2015-06-07)

  • Fix compile errors for gcc >=5.

2.3 (2013-12-08)

  • Add hash128, which returns a 128-bit signed integer.

  • Fix a misplaced operator which could cause memory leak in a rare condition.

  • Fix a malformed value to a Python/C API function which may cause runtime errors in recent Python 3.x versions.

The first two commits are from Derek Wilson. Thanks!

2.2 (2013-03-03)

  • Improve portability to support systems with old gcc (version < 4.4) such as CentOS/RHEL 5.x. (Commit from Micha Gorelick. Thanks!)

2.1 (2013-02-25)

  • Add __version__ constant. Check if it exists when the following revision matters for your application.

  • Incorporate the revision r147, which includes robustness improvement and minor tweaks.

Beware that due to this revision, the result of 32-bit version of 2.1 is NOT the same as that of 2.0. E.g.,:

>>> mmh3.hash('foo') # in mmh3 2.0
-292180858
>>> mmh3.hash('foo') # in mmh3 2.1
-156908512

The results of hash64 and hash_bytes remain unchanged. Austin Appleby, the author of Murmurhash, ensured this revision was the final modification to MurmurHash3’s results and any future changes would be to improve performance only.

License

Public Domain

except: the .gitignore file was copied from https://github.com/github/gitignore/blob/master/Python.gitignore and is copyrighted Copyright (c) 2013 GitHub, Inc. under the MIT license. See the header of .gitignore.

Authors

MurmurHash3 was created by Austin Appleby

Modified by Hajime Senuma

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mmh3-2.3.1.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file mmh3-2.3.1.tar.gz.

File metadata

  • Download URL: mmh3-2.3.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mmh3-2.3.1.tar.gz
Algorithm Hash digest
SHA256 ecadc3557c093211a70b49814cf91d6833fff403edf2d8405645e227262de928
MD5 388380bfd5f8f702ba2af7e4d72bddee
BLAKE2b-256 87a9d15efdb230b1588b9427c77ce4b608aaf478bd0ebd47b2f6a7a1bc7cce4b

See more details on using hashes here.

Release history Release notifications | RSS feed

5.3.0

144 files

5.2.1

107 files

5.2.0

121 files

5.1.0

81 files

5.0.1

96 files

5.0.0

96 files

4.1.0

80 files

4.0.1

64 files

4.0.0

64 files

3.1.0

35 files

3.0.0

26 files

2.5.1

1 file

2.5

1 file

2.4

1 file

This release

2.3.1 This release

1 file

2.3

1 file

2.2

1 file

2.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page