{"id":7244,"library":"fnv-hash-fast","title":"FNV Hash Fast","description":"FNV Hash Fast is a high-performance Python library providing FNV-1a hash functions (32-bit and 64-bit). It leverages C extensions for maximum speed, offering a significantly faster alternative to pure Python implementations. The current version is 2.0.2, with recent releases focusing on performance improvements and platform support.","status":"active","version":"2.0.2","language":"en","source_language":"en","source_url":"https://github.com/bluetooth-devices/fnv-hash-fast","tags":["hash","fnv","fnv1a","performance","utility","cryptography"],"install":[{"cmd":"pip install fnv-hash-fast","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"fnv1a_32","correct":"from fnvhash import fnv1a_32"},{"symbol":"fnv1a_64","correct":"from fnvhash import fnv1a_64"}],"quickstart":{"code":"from fnvhash import fnv1a_32, fnv1a_64\n\ndata_bytes = b\"hello world\"\nhash_32_bit = fnv1a_32(data_bytes)\nhash_64_bit = fnv1a_64(data_bytes)\n\nprint(f\"FNV-1a 32-bit hash of '{data_bytes.decode()}': {hash_32_bit}\")\nprint(f\"FNV-1a 64-bit hash of '{data_bytes.decode()}': {hash_64_bit}\")","lang":"python","description":"This example demonstrates how to compute 32-bit and 64-bit FNV-1a hashes for a given byte string. Note that the input must be a bytes-like object."},"warnings":[{"fix":"Review your code for any reliance on internal implementation details or specific build behaviors. Test thoroughly after upgrading.","message":"Version 2.0.0 introduced significant internal changes, replacing the Cython wrapper with a direct METH_O C extension for performance. While the primary Python API (`fnv1a_32`, `fnv1a_64`) appears stable for most users, this major version bump could indicate subtle behavioral changes or affect environments with specific build toolchains.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure your Python environment is 3.10 or later. Use `python --version` to check.","message":"The library explicitly requires Python 3.10 or newer. Installing on older Python versions will result in an error or an older, incompatible version being installed.","severity":"gotcha","affected_versions":"<2.0.0 for older Python, >=2.0.0 requires >=3.10"},{"fix":"Convert strings to bytes using `.encode()` before passing them to `fnv1a_32` or `fnv1a_64`, e.g., `my_string.encode('utf-8')`.","message":"FNV hash functions, like most cryptographic and hashing functions, expect a `bytes-like object` as input, not a standard Python string (`str`). Passing a string will raise a `TypeError`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure the input to `fnv1a_32()` or `fnv1a_64()` is a `bytes` object. Convert strings using `.encode('utf-8')` (or another appropriate encoding).","cause":"Attempting to hash a Python string (`str`) instead of a bytes-like object.","error":"TypeError: a bytes-like object is required, not 'str'"},{"fix":"Install the package using `pip install fnv-hash-fast`. Verify your Python environment is active and the import is `from fnvhash import ...`.","cause":"The `fnv-hash-fast` package is not installed in the current Python environment, or the import statement is incorrect.","error":"ModuleNotFoundError: No module named 'fnvhash'"}]}