dirhash
Python module and CLI for hashing of file system directories.
Decision gist · record as of 2026-08-14
Yes, if you need to verify directory integrity or detect changes in file structure and content. The low install friction, permissive license, and lack of security vulnerabilities make it safe to adopt. Dormant maintenance is a minor concern but not a blocker for a stable, single-purpose tool. Suitable for one-off verification tasks or as part of a larger testing pipeline.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later.
- Low install friction with a single runtime dependency (scantree).
- Maintenance is dormant—last release was 2024-08-03, but the repository remains active and unarchived with no recent commits.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions.
last release 2024-08-03 (741 days) · last repo commit 2024-08-03 · 60 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 13,319,927 downloads/mo, #1,287 on PyPI
Alternatives
Verify before relying
pip install dirhash
from dirhash import dirhash
dir_md5 = dirhash('path/to/directory', 'md5')
pyfiles_md5 = dirhash('path/to/directory', 'md5', match=['*.py'])
no_hidden_sha1 = dirhash('path/to/directory', 'sha1', ignore=['.*', '.*/'])- Whether multiprocessing speedup (up to 6x claimed) is achievable on typical modern hardware and directory sizes.
- Collision resistance guarantees of the Dirhash Standard implementation in practice.
What it is and what it does
dirhash is a Python module and command-line tool that generates a single hash value representing the entire contents and structure of a directory. It uses Python's hashlib to support all standard hashing algorithms (MD5, SHA1, SHA256, etc.) and follows the Dirhash Standard for consistent, collision-resistant hashes across different implementations. The tool includes glob-style filtering to include or exclude files by pattern, and optional multiprocessing to parallelize hashing across files for performance gains.
The primary use case is verifying the integrity of a set of files and their directory structure—useful for validating datasets before expensive computations, regression testing, or ensuring that generated files match expected outputs. It addresses a gap in Python tooling by providing a well-tested, documented, and standardized approach to directory hashing, with a straightforward API for both programmatic and command-line use.
Use it for
- Verify dataset integrity before training a machine learning model to catch corrupted or missing files early.
- Validate that generated output files in a regression test match a known-good directory hash.
- Check that a downloaded or synced directory has not been modified or corrupted during transfer.
- Exclude temporary or hidden files from a hash to focus on meaningful content changes.
- Quickly detect structural changes in a large directory tree without comparing individual files.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to verify directory integrity or detect changes in file structure and content.
The low install friction, permissive license, and lack of security vulnerabilities make it safe to adopt. Dormant maintenance is a minor concern but not a blocker for a stable, single-purpose tool. Suitable for one-off verification tasks or as part of a larger testing pipeline.
Install
dirhash on PyPI
Before you install
Low install friction with a single runtime dependency (scantree). Maintenance is dormant—last release was 2024-08-03, but the repository remains active and unarchived with no recent commits.
Requires Python 3.8 or later.
License in practice
MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install dirhash
from dirhash import dirhash
dir_md5 = dirhash('path/to/directory', 'md5')
pyfiles_md5 = dirhash('path/to/directory', 'md5', match=['*.py'])
no_hidden_sha1 = dirhash('path/to/directory', 'sha1', ignore=['.*', '.*/'])
Verify before relying
- Whether multiprocessing speedup (up to 6x claimed) is achievable on typical modern hardware and directory sizes.
- Collision resistance guarantees of the Dirhash Standard implementation in practice.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagescantree |
| Maintenance | Dormant 741 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 13,319,927 / month, #1,287 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: dirhash-0.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “directory hash computation”
- dirhashComputes a single hash value for an entire directory based on its…
- filehashCalculates and verifies file checksums and hashes using algorithms…
- checksumdirComputes a single hash digest of all file contents in a directory,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also checksumdir · filehash · provide-dir · hashring · dict-hash · siphash · ImageHash · uhashring · pooch · bagit