← Secret messages

Secret messages: recap

For after the lessons: one card per lesson, to check what you remember. Answer each question in your head or on paper first, then check it. Nothing here is marked.

Messages in the air

1. Everyone in the group hears

Try firstWhy does a radio group number not make a message private?

Check your answer

Every micro:bit set to that group hears every message in it, so the text is public to the group.

A micro:bit sends radio messages to every other micro:bit in its group. The group number picks the channel; it does not lock anything.

Open the lesson →

2. Scrambling is not a secret

Try firstWhy is a message that is scrambled with a method everyone knows not private?

Check your answer

Anyone who knows the method can undo it. A code needs a secret key that is separate from the method.

A scrambling method works only while it stays secret. A good code assumes the method is known and relies on a secret key.

Open the lesson →

Secret codes

3. The Caesar cipher

Try firstWhat is the key in a Caesar cipher?

Check your answer

The number of places each letter shifts. Sender and receiver must use the same number.

The Caesar cipher shifts each letter by the key. % 26 wraps from Z back to A. To decrypt, shift by 26 − key.

Open the lesson →

4. Breaking a Caesar cipher

Try firstWhy can a Caesar cipher be broken so quickly?

Check your answer

There are only 25 keys, so trying them all is quick; letter counts shorten it further.

A Caesar cipher has only 25 possible keys, so trying them all breaks it. Strength comes from having an enormous number of keys.

Open the lesson →

5. One key to lock and unlock

Try firstWhy does the receiver use the same key and the same operation as the sender?

Check your answer

XOR with the same key undoes itself: (message ^ key) ^ key = message.

XOR with a key scrambles a number; XOR with the same key unscrambles it. This is a shared-key cipher.

Open the lesson →

Trust

6. Agreeing a key in the open

Try firstWhich of the numbers go across the air in a key exchange?

Check your answer

P, G and the two mixes. The private numbers and the shared key never do.

A key exchange lets two ends agree a key in public. Each sends a mix of a private number with public numbers; each then combines the other's mix with its own private number. Both get the same key, and the key is never sent.

A sequence between micro:bit A, whose secret is 6, and micro:bit B, whose secret is 15, with the public numbers 23 and 5. A sends its mix, 8. B sends its mix, 19. A works out 19 to the power 6, mod 23, which is 2. B works out 8 to the power 15, mod 23, which is also 2. Anyone listening hears only 8 and 19, never the key.
Both ends get 2, and 2 is never sent
Open the lesson →

7. Has the message changed?

Try firstWhat does a checksum let a receiver notice?

Check your answer

That the message was damaged or changed after the checksum was worked out. A keyed checksum also stops someone making a matching one without the key.

A checksum is a number worked out from a message and sent with it. If the receiver's number is different, the message changed. Mixing in a secret key stops anyone without the key making a matching number.

Open the lesson →

8. Prove it with a challenge

Try firstWhy does a challenge and response protect a lock better than a fixed password?

Check your answer

The answer depends on a fresh challenge, so an answer that was heard before no longer fits.

A challenge and response proves a key without sending it. The lock sends a random challenge; the key answers with a value worked out from the challenge and the key; the lock checks it. Each answer fits only its own challenge.

A sequence between the key micro:bit and the lock. The key knocks. The lock sends a fresh challenge, 50. The key works out 50 times 7 plus 3, remainder 100, which is 53, and sends 53. The lock does the same sum, gets 53, and opens. A listener hears 50 and 53, which only fit this one challenge.
The key proves itself without sending the key
Open the lesson →

Defend the system

9. Capture the flag

Try firstWhat is a flag in a capture-the-flag puzzle?

Check your answer

A secret answer in a fixed form that proves you solved the puzzle.

A flag is the answer to a puzzle, typed in a fixed form, WP{...}. Here the three tools of the course each solve one puzzle.

Open the lesson →

10. Defend the door lock

Try firstName the three weaknesses of the starting lock and the fix for each.

Check your answer

Readable by the group: encrypt with a shared key. A changed message can't be told: a keyed checksum. A heard message works again: challenge and response.

A system is as strong as its weakest part. A cipher keeps a message private, a keyed checksum shows it was not changed, and a challenge and response shows a fresh message from someone with the key.

Open the lesson →