A secret note in class
You want to pass a secret note, but the teacher may catch it. So you change each letter to the next one in the alphabet.
HELLO becomes IFMMP. Your friend knows the trick, so she can read it. The teacher cannot.
Computers do the same, with much better tricks.
Key words
| Word | What it means | Example |
|---|---|---|
| Encryption | Scrambling data so only someone with the right key can read it. | HELLO becomes IFMMP |
| Decryption | Turning scrambled data back into readable data. | IFMMP becomes HELLO |
| Algorithm | A set of steps that a computer follows. | the steps that scramble a message |
| Key | A secret value used to scramble or unscramble data. | shift by 1 |
| Plaintext | The message before it is scrambled. | HELLO |
| Ciphertext | The scrambled message. | IFMMP |
| Symmetric | Encryption that uses one key for both locking and unlocking. | one house key |
| Asymmetric | Encryption that uses two keys: a public key and a private key. | a postbox |
| Hashing | Turning data into a short fixed code that cannot be turned back. | a fingerprint of a file |
The cells students fill in are left blank in this preview.
Quick check: which word?
Have a go
Quick check: which word?
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Extra: Worked example: shift by 3
| Plain letter | Count 3 steps on, naming each letter | Cipher letter |
|---|---|---|
| A | A, B, C, D | D |
| B | B, C, D, E | E |
| X | X, Y, Z, A (wrap round) | A |
| H E L L O | Shift each letter by 3 | K H O O R |
The cells students fill in are left blank in this preview.
Extra: Try it: shift the letters
message = "HELLO"
key = 3
secret = ""
for letter in message:
place = ord(letter) - ord("A")
place = (place + key) % 26
secret = secret + chr(place + ord("A"))
print(secret)
# Change the key to 1. You should see IFMMP.
This shift is only a toy
data-callouts.warning.label
Anyone can break a shift cipher in a few minutes, by trying all 25 keys. Real systems use much stronger methods, with keys that are very long.