Security

Directory Checksum – recursively hash directory contents

Directory Checksum is a command-line utility that recursively calculates checksums for the contents of a directory and can display results down to a user-selected depth. It gives a hierarchical view of what changed rather than returning only one opaque checksum for an entire tree.

The program was created primarily to investigate container image build-cache problems. When Docker, BuildKit, Buildah, or another OCI image builder unexpectedly rebuilds a layer containing COPY or ADD instructions, Directory Checksum can be run inside successive builds. Comparing its output helps identify the file or directory responsible for invalidating the cache, after filtering such as .dockerignore has already been applied.

Files are hashed from their binary content and filesystem metadata such as ownership or creation time is ignored. Directory hashes are derived from the names and checksums of their immediate children. Empty directories therefore participate in the result instead of being silently omitted. Symbolic links are not followed; their target paths are hashed instead.

Output identifies the checksum, object type, and path relative to the directory being scanned. The maximum printed depth can be adjusted to balance detail against output volume.

This is free and open source software.

Key Features

  • Recursively calculates checksums for files and directories.
  • Prints results to a configurable maximum directory depth.
  • Includes empty directories in the calculated hierarchy.
  • Uses SHA-1 checksums for files and directory entries.
  • Builds directory hashes from the names and checksums of immediate children.
  • Does not follow symbolic links and instead hashes their target paths.
  • Marks output entries as directories, files, or symbolic links.
  • Reports paths relative to the scanned directory.
  • Helps debug unexpected Docker, BuildKit, Buildah, and OCI image layer cache invalidation.

Website: github.com/MShekow/directory-checksum
Support:
Developer: Marius Shekow
License: MIT License

Directory Checksum is written in Go. Learn Go with our recommended free books and free tutorials.


Related Software

CLI Data Hashing Tools
xxHashNon-cryptographic hash algorithm
b3sumImplementation of the BLAKE3 hash function
RHashCalculate and verify magnet links and various message digests
md5sumCompute and check MD5 message digest; part of GNU Coreutils
cfvTest and create checksum files
JacksumWork with checksums, CRCs, and message digests
md5Generate / check MD5 message digest
digupUpdate md5sum or shasum digest files
cksumCompute and verify file checksums
HashratHash-generation utility
Directory ChecksumRecursively calculate checksums for directory contents
paqFast BLAKE3 hashing tool for files and directories
ddgstHashing and checksum utility
QCalcFileHashHash calculator
hashdirChecksum directories and files
Hash CalculatorCalculates around 50 cryptographic hashes of strings and files
danoHashdeep/md5tree for media files
sha3sumKeccak, SHA-3, SHAKE, and RawSHAKE checksum utilities
luhaSimple file checksum tool
filepackFile hashing and verification
bitratFast file checksum tool supporting multiple hash algorithms
b2sumCalculate BLAKE2 checksums
Additional tools:
hashitGenerate file hashes quickly
hashdeepGenerate and verify file hashes
cksfvCreate and check sfv listings using CRC32 checksums
cksfv.rsReimplements the classic cksfv tool

Read our verdict in the software roundup.


Best Free and Open Source Software Explore our carefully curated directory of recommended free and open source software, covering every major software category.

The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more.

Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted