Hashing, encoding and encryption

A hash is one way, an encoding is reversible by anyone, and encryption needs a key. This set checks that you can tell the three apart, read the signs in the output of each, and say what each one is actually good for.

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 Which of the three can be reversed by anyone, with no key and no password?
2 What does the U2FsdGVkX1 prefix at the start of an openssl enc ciphertext tell you?
3 Why can a hash not be turned back into the text it came from?
4 You download a file and compute its SHA-256 hash, but it does not match the one the vendor published. What does that tell you?

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, encode and encrypt the same text

This writes a small file, then does three things to it: a hash, a base64 encoding and an encryption with a passphrase. Read the four output lines and match each one to the job that produced 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.

printf 'hello termux' > "$HOME/msg.txt"; sha256sum "$HOME/msg.txt"; base64 "$HOME/msg.txt"; openssl enc -aes-256-cbc -pbkdf2 -pass pass:hunter2 -base64 -in "$HOME/msg.txt" -out "$HOME/msg.enc"; cat "$HOME/msg.enc"; echo; openssl enc -d -aes-256-cbc -pbkdf2 -pass pass:hunter2 -base64 -in "$HOME/msg.enc"
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