{"id":22370,"library":"siphashc","title":"Siphashc","description":"A C-based Python module implementing SipHash-2-4, a fast cryptographic hash function designed for hash tables and message authentication. Current version is 2.7, requiring Python >=3.10. Releases are intermittent.","status":"active","version":"2.7","language":"python","source_language":"en","source_url":"https://github.com/WeblateOrg/siphashc","tags":["hash","siphash","cryptographic","c-extension"],"install":[{"cmd":"pip install siphashc","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The module exposes a single function siphash; direct import may cause confusion with other siphash libraries.","wrong":"from siphashc import siphash","symbol":"siphash","correct":"import siphashc; siphashc.siphash(data)"}],"quickstart":{"code":"import siphashc\ndata = b'hello world'\nhashed = siphashc.siphash(data)\nprint(hashed)  # e.g. 0x9f8d5a4b3c2e1f0a","lang":"python","description":"Hash a bytes object using SipHash-2-4."},"warnings":[{"fix":"Call data.encode('utf-8') before hashing.","message":"The function only accepts bytes objects; strings must be encoded first.","severity":"gotcha","affected_versions":"all"},{"fix":"Convert to hex with hex(hashed) if needed.","message":"siphashc returns a 64-bit unsigned integer, not a hex string.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Python >=3.10.","message":"Python 3.9 and below are no longer supported as of version 2.7.","severity":"deprecated","affected_versions":">=2.7"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Encode the string: siphashc.siphash('hello'.encode('utf-8'))","cause":"Passing a string instead of bytes to siphash.","error":"TypeError: a bytes-like object is required, not 'str'"},{"fix":"Ensure siphashc >=2.0 is installed and use import siphashc, then siphashc.siphash().","cause":"Wrong import path or older version.","error":"AttributeError: module 'siphashc' has no attribute 'siphash'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}