Build a hash and checksum tool

A checksum file records what your files were when you trusted them, and sha256sum -c tells you later whether any of them changed. This set covers that workflow, the POSIX way to compare two digests, the older tools, and what a matching digest 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 A line from sha256sum -c reads b.txt: OK. What does that mean?
2 Why does a portable script use [ "$a" = "$b" ] rather than [ "$a" == "$b" ]?
3 A file and its published SHA-256 digest both came from the same download page. What does a matching digest prove?
4 Why is MD5 unsuitable for checking a file against an attacker, even though it still catches corruption?

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.

Write a checksum file and verify against it

The hashtool.sh you finished is saved next to you. This creates a small file, writes a checksum file for it, then checks the file against that list. Paste the check output.

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.

printf 'alpha ' > a.txt; bash hashtool.sh --write SUMS a.txt; bash hashtool.sh --check SUMS
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