{"id":28203,"library":"spookyhash","title":"spookyhash","description":"A Python wrapper for SpookyHash version 2, a fast non-cryptographic hash function. Current version 2.1.1 provides hash128 and hash64 algorithms with an API similar to hashlib. Release cadence is low; last update July 2024.","status":"active","version":"2.1.1","language":"python","source_language":"en","source_url":"https://github.com/buhanec/spookyhash","tags":["hash","non-cryptographic","spookyhash","fast-hashing"],"install":[{"cmd":"pip install spookyhash","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"hash128 is a function; no common wrong import.","wrong":"","symbol":"hash128","correct":"from spookyhash import hash128"},{"note":"hash64 is a function; no common wrong import.","wrong":"","symbol":"hash64","correct":"from spookyhash import hash64"},{"note":"Hash is the class for incremental hashing; no common wrong import.","wrong":"","symbol":"Hash","correct":"from spookyhash import Hash"}],"quickstart":{"code":"from spookyhash import hash128, hash64\n\n# Simple hashing\nprint(hash128(b\"hello world\"))\nprint(hash64(b\"hello world\"))\n\n# Incremental hashing (like hashlib)\nfrom spookyhash import Hash\nh = Hash()\nh.update(b\"hello\")\nh.update(b\" world\")\nprint(h.hexdigest())","lang":"python","description":"Quickstart: compute hash of bytes or use incremental hashing."},"warnings":[{"fix":"Update code to expect str from hexdigest(), or use .digest() for bytes.","message":"In version 2.1.0, Hash.hexdigest() changed from returning bytes to returning str, aligning with hashlib. Code expecting bytes will break.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Use hashlib or cryptography for secure hashing.","message":"spookyhash is non-cryptographic; do not use for security purposes like password hashing or digital signatures.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to 2.1.1 and follow the current API.","message":"The older spookyhash package (version 1.x) had a different API. Ensure you are using version 2.x and importing from 'spookyhash'.","severity":"deprecated","affected_versions":"1.x"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use from spookyhash import hash128 (or hash64).","cause":"Old API from version 1.x imports incorrectly.","error":"AttributeError: module 'spookyhash' has no attribute 'spookyhash128'"},{"fix":"Encode the string: hash128(b\"text\") or hash128(\"text\".encode()).","cause":"Passing a string instead of bytes to hash functions.","error":"TypeError: a bytes-like object is required, not 'str'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}