--- id: dirhash version: "0.5.0" license: MIT license_treatment: permissive maintenance: dormant --- # dirhash — Python module and CLI for hashing of file system directories. License: permissive · Maintenance: dormant · Downloads: 13.3M/mo ## 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 above — verify before relying. Computes a single hash value for an entire directory based on its files' structure and content, supporting all hashlib algorithms and glob-style filtering. 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 pip install dirhash uv add dirhash poetry add dirhash ## Installing dirhash 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. 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=['.*', '.*/']) Requires Python 3.8 or later. 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_current - Install friction: low - Maintenance: dormant - Downloads: 13.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags directory hash computation, folder integrity verification, recursive file hashing, directory checksum, bulk file hash, dataset integrity check, multiprocessing directory hash, file-integrity, hashing, verification [View on SkillFed](https://skillfed.io/packages/dirhash) · [View on PyPI](https://pypi.org/project/dirhash/)