Glossary

File Hash

A file hash is a fixed-length value calculated from every byte of a file. If even one bit changes, the hash changes completely, so comparing hashes tells you whether two files are identical.

What does a file hash look like?

A SHA-256 hash is 64 hexadecimal characters regardless of whether the file is a 2 KB config or a 4 GB disk image. Running sha256sum on a file prints that value followed by the file name. The same file always produces the same hash on any machine and any operating system. Two different files produce different hashes for all practical purposes, which is what makes the value useful as a fingerprint. Hashing explains the general function behind it.

What are file hashes used for on a server?

  • Verifying downloads: an ISO, a release tarball or a binary is checked against the hash its publisher lists.
  • Checking transfers: after copying a database dump between Chicago and Amsterdam, hashes on both ends prove the copy is whole.
  • Backup integrity: storing hashes alongside archives reveals silent corruption months later.
  • Change detection: integrity tools record hashes of system binaries and alert when one changes unexpectedly.
  • Deduplication: backup and storage systems identify identical chunks by hash and store them once.
  • Malware lookups: security teams share hashes of known bad files so others can search for them.

Which algorithms should I use?

AlgorithmOutput lengthStatusCommand
MD5128 bitsBroken against deliberate tampering; fine only for accidental corruptionmd5sum
SHA-1160 bitsPractical collisions shown; avoid for securitysha1sum
SHA-256256 bitsStandard choice todaysha256sum
SHA-512512 bitsSecure, often faster than SHA-256 on 64-bit CPUs without SHA extensionssha512sum
BLAKE2bUp to 512 bitsSecure and fastb2sum
BLAKE3, xxHash256 bits, 64 or 128 bitsBLAKE3 secure and very fast; xxHash for speed only, not securityb3sum, xxhsum

How do I create and verify a checksum list?

Hash a whole directory into one file, move the data, then check it on the other side:

cd /srv/exports/2026-12
find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS
rsync -a --info=progress2 /srv/exports/2026-12/ backup@203.0.113.120:/srv/archive/2026-12/
ssh backup@203.0.113.120 'cd /srv/archive/2026-12 && sha256sum --quiet -c SHA256SUMS && echo all-match'

--quiet prints only failures, so a clean run ends with your confirmation text. For a single file, sha256sum -c <<< "HASH filename" compares against a value you paste in; note the two spaces between hash and name. Rsync over SSH covers the copy step.

Why should checksum lists be signed?

A hash only proves a file matches the list. If an attacker can replace both the download and the list on a compromised mirror, the check passes. Projects therefore sign their checksum files with GPG or minisign. You verify the signature with the project key you obtained separately, then trust the hashes inside. On Debian and Ubuntu, gpg --verify SHA256SUMS.gpg SHA256SUMS after importing the release key is the typical step for installer images. Package managers such as apt and dnf do this automatically for every package through signed repository metadata.

How does hashing help detect tampering on a running system?

File integrity monitors like AIDE build a database of hashes and attributes for system directories, then compare on a schedule:

dnf install -y aide          # or apt install -y aide on Debian and Ubuntu
aide --init
mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
aide --check | head -40

After legitimate updates, refresh the database so only unexpected changes stand out. For stronger assurance, store a copy of the database off the machine, because an intruder with root could otherwise rewrite it. Rootkit explains why this matters.

How do I compare a whole tree without a checksum file?

For a one-off comparison between two machines, hash each side into a sorted list and diff the two. Run cd /srv/site && find . -type f -exec b2sum {} + | sort -k2 > /tmp/left.txt on the first box, do the same on the second, copy one list across and run diff /tmp/left.txt /tmp/right.txt. Every line that differs names a file whose content or presence does not match. rsync offers a related shortcut: rsync -anc --delete with checksum mode lists files that would change without copying anything.

Is hashing large files slow?

Usually the disk is the limit. SHA-256 runs at well over a gigabyte per second per core on CPUs with SHA extensions, and BLAKE3 uses several cores at once. Hashing a terabyte archive on the S12 with 2x 4 TB NVMe NVMe takes minutes rather than hours, and xargs -P spreads many files across all 32 threads.

Storage-Rich Machines for Archives and Backups

ServerProcessorCores / threadsMemoryStorageNetworkPer monthSmallest order
S3Intel Xeon E-2356G6 / 1264 GB DDR42x 1 TB NVMe2x 10 Gbps$80.38$80.38 (1 month)
S12Intel Core i9-14900K24 / 32192 GB DDR52x 4 TB NVMe2x 10 Gbps$202.82$202.82 (1 month)
D52x Intel Xeon Gold 5315Y16 / 32256 GB DDR42x 2 TB NVMe2x 25 Gbps$305.34$305.34 (1 month)
D212x Intel Xeon Gold 643064 / 128256 GB DDR56x 15.36 TB NVMe + 1x 1 TB NVMe (boot)2x 25 Gbps$1,152.97$1,152.97 (1 month)

Keep Reading

Hashing

One-way functions that map any input to a fixed-size value, their uses from hash tables to passwords, and the right algorithm for each job.

Open

Rootkit

Malware that hides an intruder with full control of a system, the main kinds, warning signs and why a reinstall is the safe fix.

Open

Rsync over SSH

Copy and mirror folders between machines with rsync over SSH: trailing slashes, dry runs, custom ports, sudo on the far side and bandwidth caps.

Open

Backup server

A machine whose job is to receive, keep and restore copies of other systems, and how to size one on budget bare metal.

Open

FAQ

Quick Answers

A fixed-length fingerprint calculated from a file content. Any change to the file produces a completely different hash.

Only for spotting accidental corruption. It can be deliberately forged, so use SHA-256 or BLAKE2 when tampering is a concern.

Run sha256sum on it and compare the result with the published hash, ideally after verifying the signature on the checksum file.

In theory yes, but with SHA-256 no such pair has ever been found and finding one is far beyond current computing power.

A file integrity checker that records hashes of system files and reports any that change unexpectedly.