{"id":21128,"library":"dict-hash","title":"dict-hash","description":"Python package to hash dictionaries using default hash, md5, sha256 and more. Supports nested structures, pandas, numpy, polars, datetime, and custom hash functions. Active development with recent additions including approximate hashing and support for timedelta. Current version: 1.3.7.","status":"active","version":"1.3.7","language":"python","source_language":"en","source_url":"https://github.com/LucaCappelletti94/dict_hash","tags":["hash","dictionary","fingerprint","cryptographic"],"install":[{"cmd":"pip install dict-hash","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for hashing numpy arrays","package":"numpy","optional":true},{"reason":"Required for hashing pandas DataFrames/Series","package":"pandas","optional":true},{"reason":"Required for hashing polars DataFrames/Series","package":"polars","optional":true}],"imports":[{"note":"Direct function import for SHA256 hashing","symbol":"sha256","correct":"from dict_hash import sha256"}],"quickstart":{"code":"from dict_hash import sha256\n\nmy_dict = {\"a\": 1, \"b\": [2, 3], \"c\": {\"d\": \"text\"}}\nhash_value = sha256(my_dict)\nprint(hash_value)  # Example: b\"...\"","lang":"python","description":"Compute a SHA256 hash of a dictionary."},"warnings":[{"fix":"Use 'sha256' or 'md5' instead of 'dict_hash' for a stable hash.","message":"The library does not guarantee deterministic hashing across different Python versions (e.g., default hash seeds). Use sha256 or another cryptographic hash for consistency.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure pandas is installed if you hash dictionaries containing pandas objects, or update code to handle NumPy-only dicts separately.","message":"Version 1.3.0 changed the handling of NumPy objects; older code may produce different hashes if pandas is not installed.","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Replace 'dict_hash(my_dict, hash_func='sha256')' with 'from dict_hash import sha256; sha256(my_dict)'.","message":"The 'hash_func' parameter in earlier versions is deprecated; use named functions like 'sha256' instead.","severity":"deprecated","affected_versions":"<1.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with 'pip install dict-hash' and import using 'from dict_hash import ...'.","cause":"Package not installed or installed as 'dict-hash' but imported incorrectly.","error":"ModuleNotFoundError: No module named 'dict_hash'"},{"fix":"Update to latest version and use 'from dict_hash import md5' then call 'md5(my_dict)'.","cause":"In older versions, hash function names were not exported; direct use of string names may fail.","error":"ValueError: Invalid hash algorithm: md5"},{"fix":"Install pandas: 'pip install pandas'. Then use 'from dict_hash import sha256; sha256(my_dict)'.","cause":"Trying to hash a pandas DataFrame without pandas support installed or using a custom serializer.","error":"TypeError: Object of type DataFrame is not JSON serializable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}