Murmurhash2 is a Python library providing fast, non-cryptographic hash functions, specifically bindings for the MurmurHash2 and MurmurHash3 algorithms. It is designed for high performance in applications such as hash tables, caching, and data distribution, rather than for security-sensitive use cases. The current version, 0.2.10, was last released in February 2022 and supports Python 3.6+ environments. The project appears to be in a maintenance status with infrequent updates.
pip install murmurhash2Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use both `murmurhash2` and `murmurhash3` functions. Input data must be provided as bytes.
For security-sensitive applications, use cryptographic hash functions like `hashlib.sha256`.
Always encode string inputs to bytes explicitly, e.g., `my_string.encode('utf-8')`.Ensure consistent byte representation of input data, especially when hashing data structures or integers that might have different endianness on different systems. Test cross-platform consistency if required.
Consider using `murmurhash3` instead of `murmurhash2` for new implementations unless specific compatibility with MurmurHash2 is required.
Ensure the library is installed using pip: `pip install murmurhash2`
To import functions from the `murmurhash2` library, use: `from murmurhash2 import murmurhash2, murmurhash3`
Either import the specific functions: `from murmurhash2 import murmurhash2, murmurhash3` or call the function using the module prefix: `import murmurhash2; murmurhash2.murmurhash2(b'key', 0)`
Encode your string to bytes before passing it to the hash function, e.g., `murmurhash2(b'your_string_here', SEED)` or `murmurhash2('your_string_here'.encode('utf-8'), SEED)`No dependency data recorded yet.