skillfed

dict-hash

Python package to hash dictionaries using default hash, md5, sha256 and more.

dict-hash v1.3.7 86.9K downloads/30d#13,831 on PyPI27
Permissive license MIT AGING released

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-hash

uv

uv add dict-hash

poetry

poetry add dict-hash

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

hash dictionaries pythondict hashing librarypandas dataframe hashingconsistent hash functionsha256 dictionarynumpy array hashingpolars dataframe hash
hashingcachingdata-structures

More Utilities packages