File integrity

A hash turns a whole file into one short line. Hash it when you trust it, hash it again later, and the two lines tell you whether anything changed. This set covers what a digest depends on, how a check works, and what a FAILED line does and does not prove.

4 questions 1 task Read the lesson

Questions

Each one is marked as you go, and the explanation arrives straight after, which is the part worth reading.

4 questions, marked as you go.

1 What does a sha256 digest of a file depend on?
2 What does sha256sum -c manifest do?
3 What does a FAILED line prove?
4 Why keep the manifest somewhere the watched file cannot reach?

Tasks

These need your own device. Run the command in Termux, then paste what it printed. The marking looks at what the output means, so spacing, version numbers and ordering do not matter. If you have not installed anything yet, the lesson covers the setup.

Make a manifest and check it

This makes two small files, builds a manifest of their hashes with find and sha256sum, then checks the manifest straight back. Watch the two halves: the digests first, then the OK lines.

Run this in Termux On your own device. Nothing on this page executes it. The command runs in your terminal, and this box only reads what you paste back.

cd ~; mkdir -p watch; printf 'alpha\n' > watch/a.txt; printf 'beta\n' > watch/b.txt; find watch -type f -exec sha256sum {} + | sort -k2 > watch.sha256; cat watch.sha256; sha256sum -c watch.sha256
Marking your own work Both halves of this are checked in your browser, with no server involved, so nothing stops you from pasting output you did not run. The tasks are written so that the easiest way to pass one is to actually do it and read the result, which is the whole intention.

All sets Read the lesson