dict-hash
Python package to hash dictionaries using default hash, md5, sha256 and more.
What it is and what it does
dict_hash solves the problem that Python dictionaries cannot be hashed natively because they are mutable. This library provides two main functions: dict_hash for session-based hashing using Python's native hash function, and sha256 (plus other cryptographic algorithms) for consistent, reproducible hashes. It extends this capability to complex data structures—Pandas and Polars DataFrames and Series, NumPy arrays, and Numba objects—making it useful for caching, deduplication, and data versioning workflows.
The package handles edge cases like recursive objects (dictionaries containing themselves) and unhashable nested objects through configurable error handling modes (raise, warn, or ignore). It also offers an approximation mode that subsamples large objects for faster, lightweight hashing. Custom objects can implement the Hashable interface to define their own hashing behavior.
Use it for:
- Create cache keys from function arguments containing dictionaries or DataFrames to enable memoization.
- Generate consistent checksums for Pandas or Polars datasets to detect changes or duplicates.
- Hash NumPy arrays as part of experiment tracking or model versioning pipelines.
- Implement deduplication logic for complex nested data structures in ETL workflows.
- Build content-addressed storage systems where data is identified by its hash digest.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates consistent hashes for Python dictionaries and supports hashing Pandas, Polars, Numba, and NumPy objects using default hash or cryptographic algorithms like SHA256.
Yes, with conditions. The package is stable and permissively licensed, but the high install friction from its compiled dependency (deflate_dict) and aging maintenance status (277 days since last release) mean you should verify wheel availability for your platform before adopting it. If you need to hash dictionaries or data science objects and can tolerate the dependency, it is a solid choice; otherwise, consider whether a simpler pure-Python alternative suits your use case.
Install
dict-hash on PyPI
pip
pip install dict-hashuv
uv add dict-hashpoetry
poetry add dict-hashInstalling dict-hash
Before you install
High install friction due to a compiled dependency (deflate_dict). Package is in aging maintenance status with 277 days since last release, though the repository remains active and has been maintained since 2019.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install dict-hash
from dict_hash import sha256
my_dict = {"key": "value"}
my_hash = sha256(my_dict)
Requires deflate_dict as a compiled runtime dependency, which may require a C compiler or pre-built wheels for your platform.
Verify before relying
- Whether deflate_dict wheels are available for all major platforms or if compilation is required during install.
- Performance characteristics when hashing very large DataFrames or arrays with approximation mode enabled.
- Compatibility guarantees with Pandas 2.x and NumPy 2.x beyond the stated support claim.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | 1 — deflate_dict |
| Maintenance | aging — 277 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 86,870/month — #13,831 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dict_hash-1.3.7.tar.gz
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
filehashCalculates and verifies file checksums and…
permissive · top 15,000 on PyPI
polars-hashPolars-hash adds cryptographic and…
unclear · top 15,000 on PyPI
hashringImplements consistent hashing in Python using…
permissive · top 15,000 on PyPI
dirhashComputes a single hash value for an entire…
permissive · top 5,000 on PyPI
uhashringuhashring implements consistent hashing in pure…
permissive · top 15,000 on PyPI
ImageHashImageHash computes perceptual fingerprints of…
permissive · top 5,000 on PyPI
pysha3Provides SHA-3, SHAKE, and Keccak hash…
permissive · top 15,000 on PyPI
bbhashBuilds minimal perfect hash functions for…
unclear · top 15,000 on PyPI
safe-pysha3Provides SHA-3, SHAKE, and Keccak hash…
permissive · top 15,000 on PyPI
poseidon-pyPoseidon hash implementation in Python with a…
unclear · top 15,000 on PyPI