{"id":5661,"library":"mmhash3","title":"mmhash3 (MurmurHash3)","description":"mmhash3 is a Python wrapper for MurmurHash (MurmurHash3), a collection of fast and robust non-cryptographic hash functions. This specific library (version 3.0.1, last updated Oct 2022) is a fork of the original 'mmh3' library, which was considered unmaintained at the time of its creation. For a more actively developed and current version of a MurmurHash3 Python wrapper, users often look to the 'mmh3' package (pypi.org/project/mmh3).","status":"maintenance","version":"3.0.1","language":"en","source_language":"en","source_url":"https://github.com/Fokko/mmhash","tags":["hashing","murmurhash3","non-cryptographic","performance","data mining"],"install":[{"cmd":"pip install mmhash3","lang":"bash","label":"Install mmhash3"}],"dependencies":[],"imports":[{"note":"Despite the package name 'mmhash3', the main module to import is 'mmh3', consistent with its origins as a fork of the 'mmh3' library. Attempting to import 'mmhash3' directly will result in an ImportError.","wrong":"import mmhash3","symbol":"hash","correct":"import mmh3\nmmh3.hash('your_string')"}],"quickstart":{"code":"import mmh3\n\n# Hash a string to a 32-bit signed integer\nhash_value_32_bit = mmh3.hash(\"hello world\")\nprint(f\"32-bit hash: {hash_value_32_bit}\")\n\n# Hash with a seed\nhash_value_seeded = mmh3.hash(\"hello world\", 42)\nprint(f\"32-bit hash with seed 42: {hash_value_seeded}\")\n\n# Get a 32-bit unsigned integer hash\nhash_value_unsigned = mmh3.hash(\"hello world\", signed=False)\nprint(f\"32-bit unsigned hash: {hash_value_unsigned}\")\n\n# Get a 128-bit hash as a single unsigned integer\nhash_value_128_bit = mmh3.hash128(\"hello world\", 0)\nprint(f\"128-bit hash: {hash_value_128_bit}\")","lang":"python","description":"Demonstrates basic hashing of strings using the default 32-bit algorithm, with and without a seed, and obtaining a 128-bit hash."},"warnings":[{"fix":"Always use `import mmh3` in your Python code.","message":"The library is installed via `pip install mmhash3`, but the Python module to import is `mmh3`. Importing `mmhash3` will fail.","severity":"gotcha","affected_versions":"All versions of mmhash3"},{"fix":"Ensure your tests or dependent systems are updated to expect the hash values generated by current versions of MurmurHash3, or explicitly use older library versions if exact historical compatibility is critical and understood.","message":"Results of 32-bit `mmh3.hash()` changed in version 2.1 (prior to 3.0.1). If your application relies on specific hash values from very old `mmh3` versions (pre-2.1), the results from `mmhash3` (v3.0.1) will differ.","severity":"breaking","affected_versions":"2.1 and later (including 3.0.1)"},{"fix":"Use the `signed=False` keyword argument for `mmh3.hash()` or `mmh3.hash64()` to obtain unsigned values if needed for compatibility with other systems or libraries. Be aware that `hash64` always returns two values.","message":"By default, `mmh3.hash()` and `mmh3.hash64()` return signed integers, while `mmh3.hash128()` returns an unsigned integer. This can lead to different results compared to other MurmurHash3 implementations that might default to unsigned values. The `mmh3.hash64()` function also returns two 64-bit values as a tuple.","severity":"gotcha","affected_versions":"All versions (including 3.0.1)"},{"fix":"Ensure seed values are 32-bit integers. For compatibility with older systems using negative 32-bit seeds, ensure the implicit conversion behavior is understood.","message":"The behavior of seed values changed around version 2.4 (prior to 3.0.1), shifting from signed to unsigned 32-bit integers. While existing 32-bit signed seeds *should* yield the same results, using non-32-bit or intentionally negative seeds without careful consideration may lead to unexpected results or compatibility issues.","severity":"gotcha","affected_versions":"2.4 and later (including 3.0.1)"},{"fix":"Evaluate migrating to the actively maintained `mmh3` library (pip install mmh3) for ongoing support and features. Be aware of potential breaking changes if migrating, especially regarding endianness (mmh3 v4.0.0 made it endian-neutral) and seed handling.","message":"This `mmhash3` package (version 3.0.1) is a fork of an older, unmaintained `mmh3` library. For active development, newer Python versions support, and potential performance improvements, consider using the actively maintained `mmh3` package (github.com/hajimes/mmh3, pypi.org/project/mmh3) which is currently at version 5.x.x.","severity":"deprecated","affected_versions":"All versions of mmhash3 (PyPI slug)"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}