Artifact Naming & Checksums
An artifact is what users actually download. Two properties make artifacts trustworthy: a name that says exactly what it is, and a checksum that proves it arrived intact. A third, reproducibility, lets anyone check that the artifact really came from the tagged source.
Naming
A name answers "which program, which version, for which platform, in which format?" without opening the file:
<name>-<version>-<os>-<arch>[-<variant>].<ext>
tad-1.4.2-linux-x86_64.tar.gz
tad-1.4.2-linux-aarch64-musl.tar.gz
tad-1.4.2-macos-arm64.zip
tad-1.4.2-windows-x86_64.zip
tad-1.4.2.tar.gz (source)
tad_1.4.2-1_amd64.deb (Debian's own convention)
tad-1.4.2-1.x86_64.rpm (RPM's own convention)
SHA256SUMS, SHA256SUMS.sig (checksums and their signature)Rules that save support tickets:
- The version is in the file name.
tad-linux.tar.gzoverwritten on every release means nobody knows what they have. - Pick one vocabulary for platforms and keep it:
x86_64/aarch64(uname, Rust targets) oramd64/arm64(Go, Docker, Debian). Install scripts parse these names. - Archives unpack into a versioned top folder (
tad-1.4.2/…) so extracting two versions side by side is safe. - Follow the native convention for OS packages:
name_version-revision_arch.deb,name-version-release.arch.rpm. Package tools generate those names for you. - Never re-upload different bytes under the same name. Fix forward with a new version (Semantic Versioning).
Checksums
sha256sum writes one line per file, <hash> <name>, and sha256sum -c checks a list. A release publishes one SHA256SUMS file for all its artifacts:
mkdir -p tad/bin && cd tad
printf '#!/bin/sh\necho "tad 1.4.2"\n' > bin/tad && chmod 755 bin/tad
echo "MIT License" > LICENSE
mkdir -p dist
for platform in linux-x86_64 linux-aarch64; do
tar -czf "dist/tad-1.4.2-$platform.tar.gz" bin LICENSE
done
cd dist
sha256sum tad-1.4.2-*.tar.gz > SHA256SUMS
wc -l < SHA256SUMS
echo "--- a user downloads one artifact and the checksum list"
mkdir ../download && cp tad-1.4.2-linux-x86_64.tar.gz SHA256SUMS ../download && cd ../download
sha256sum --ignore-missing -c SHA256SUMS
echo "--- a corrupted download"
printf 'X' | dd of=tad-1.4.2-linux-x86_64.tar.gz bs=1 seek=100 conv=notrunc status=none
sha256sum --ignore-missing -c SHA256SUMS; echo "exit code: $?"2
--- a user downloads one artifact and the checksum list
tad-1.4.2-linux-x86_64.tar.gz: OK
--- a corrupted download
tad-1.4.2-linux-x86_64.tar.gz: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
sha256sum: SHA256SUMS: no file was verified
exit code: 1
--ignore-missing is what makes one SHA256SUMS for the whole release practical: users only have the file they downloaded. The exit code is what install scripts and CI check.
A checksum protects against corruption, not against an attacker who can replace both the artifact and SHA256SUMS on the same server. That needs a signature over the checksum file (next lesson) or checksums published through a separate, trusted channel.
Reproducible archives
Run the same tar twice and you usually get different bytes: file order depends on the file system, and the archive stores modification times, owners and (in gzip's header) a timestamp. Then nobody can rebuild the artifact and confirm it matches. GNU tar and gzip can pin all of those:
mkdir -p tad/bin && cd tad
printf '#!/bin/sh\necho "tad 1.4.2"\n' > bin/tad && chmod 755 bin/tad
echo "MIT License" > LICENSE
naive() { tar -cf - bin LICENSE | gzip > "$1"; }
repro() {
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf - bin LICENSE | gzip -n > "$1"
}
naive a.tar.gz; sleep 1; touch bin/tad LICENSE; naive b.tar.gz
repro c.tar.gz; sleep 1; touch bin/tad LICENSE; repro d.tar.gz
same() { [ "$(sha256sum < "$1")" = "$(sha256sum < "$2")" ] && echo identical || echo different; }
echo "naive build twice: $(same a.tar.gz b.tar.gz)"
echo "reproducible build twice: $(same c.tar.gz d.tar.gz)"
tar -tvf c.tar.gz | awk '{print $1, $2, $4, $5, $6}'naive build twice: different
reproducible build twice: identical
drwxr-xr-x 0/0 2026-01-01 00:00 bin/
-rwxr-xr-x 0/0 2026-01-01 00:00 bin/tad
-rw-r--r-- 0/0 2026-01-01 00:00 LICENSE
The flags, one by one:
| Flag | Removes |
|---|---|
--sort=name |
file-system order |
--mtime="@$SOURCE_DATE_EPOCH" |
file modification times (all files get the same fixed time) |
--owner=0 --group=0 --numeric-owner |
the builder's user and group |
--pax-option=…delete=atime,delete=ctime |
access/change times that the PAX format may add |
gzip -n |
the original name and time stamp in the gzip header |
SOURCE_DATE_EPOCH is the standard variable for "the time this release is from", normally set to the commit time (git log -1 --format=%ct). git archive (used in the intro) does all of this by construction for source archives. Zip files need the same care (zip -X, fixed times with touch -d), and compilers have their own sources of non-determinism, covered in Reproducible Builds.
Test yourself
Why does sha256sum -c need --ignore-missing when a user verifies one download?
- To skip corrupted files
- SHA256SUMS lists every artifact, and the user only downloaded one
- To make it faster
- Because of symlinks
What does a published checksum NOT protect against on its own?
- A truncated download
- Bit flips in transit
- An attacker who replaces both the artifact and the checksum file
- Downloading the wrong platform
Which tar/gzip options make an archive byte-for-byte reproducible?
-vand-z- Sorted names, fixed mtime, fixed owner/group and
gzip -n --remove-files- Only
--sort=name