brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: xxhsum is a very fast checksum for spotting changed files, not for security

Files
~/tips/tip-xxhsum-fast-checksum

xxhsum -H64 backup.tar > backup.xxh

Quickly detect a changed or damaged file with a very fast, non-cryptographic hash.

When I only want to know if a big file changed or got copied correctly, a cryptographic hash is more than I need.

xxhsum prints checksums with the xxHash algorithm, which is fast and non-cryptographic. Choose the size with -H: 32, 64 or 128, or -H3 for XXH3:

xxhsum -H64 backup.tar > backup.xxh
xxhsum -c backup.xxh

The first line writes the checksum, the second verifies it. --quiet hides the OK lines, and --status prints nothing at all and leaves the result in the exit code.

A caveat: a non-cryptographic hash isn’t built to resist someone tampering with a file on purpose. Use xxhsum to catch accidents such as a broken copy, and sha256sum when the file comes from somewhere you don’t trust.

Further reading: xxHash project

More Files tips sha256sum -c --ignore-missing SHA256SUMS unzip -j archive.zip -d out/ Files > More > Select > pick files > More > Compress ls -lhS /var/log file photo.jpg data.bin All Files tips (15) All topics

Link