Passwords and keys

A password is checked by hashing it again and comparing, never by reversing a stored value. This set covers why that matters, how to make a strong secret, and how the permissions on a private key tell you whether it is safe.

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 Why are passwords stored as hashes rather than as encrypted text?
2 What does the -n do in echo -n "correct horse battery staple" | sha256sum?
3 In the listing of ~/.ssh, the private key shows -rw-------. What does that mean?
4 Why is a long passphrase of several ordinary words stronger than a short password full of symbols?

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.

Hash a passphrase, then make a real secret

This hashes the same passphrase twice, then reads 32 random bytes from the system. Watch the first two lines and then the third: the hash is identical both times, and the random secret would be different every time you ran it.

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.

echo -n "correct horse battery staple" | sha256sum; echo -n "correct horse battery staple" | sha256sum; head -c 32 /dev/urandom | base64
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