← Code

Secret messages

Radio is a shared space, so how do you keep a message private, know it was not changed, and know who sent it? Build ciphers, a checksum and a challenge–response lock with micro:bits, then defend a radio door lock in a capture-the-flag finale.

Start1. Everyone in the group hears

Messages in the air

Radio reaches everyone in the group, so a plain message is a public one.

1Everyone in the group hearsNot started

A radio group is a channel, not a lock. Every micro:bit in the group hears every message, so anything sent in plain text is public to the group.

  1. Predict
  2. Run
  3. Investigate › The group number
  4. Investigate › The blocks
  5. Investigate › Who hears it
  6. Modify
  7. Make
Start lesson
2Scrambling is not a secretNot started

A scrambling method works only while nobody knows the method. A real code has a public method and a secret key.

  1. Predict
  2. Run
  3. Investigate › Inside reverse
  4. Investigate › Undoing it
  5. Investigate › The parts of a code
  6. Investigate › What to protect
  7. Modify
  8. Make
Start lesson

Secret codes

Build a Caesar cipher, see why it is easy to break, then lock messages with a shared key.

3The Caesar cipherNot started

Shift every letter along the alphabet by a secret number. The method is public; the number is the key.

  1. Predict
  2. Run
  3. Investigate › Z wraps round
  4. Investigate › Key zero
  5. Investigate › Going back
  6. Modify
  7. Make
Start lesson
4Breaking a Caesar cipherNot started

A Caesar cipher has only 25 useful keys, so trying them all breaks it in moments. Seeing why is how you learn what a strong key needs.

  1. Predict
  2. Run
  3. Investigate › How many tries
  4. Investigate › Counting letters
  5. Investigate › A longer message
  6. Modify
Start lesson
5One key to lock and unlockNot started

XOR mixes a number with a key. Doing it again with the same key brings the number back, so one shared key works in both directions.

  1. Predict
  2. Run
  3. Investigate › Locking a number
  4. Investigate › A wrong key
  5. Investigate › Why it works both ways
  6. Modify
  7. Make › The PIN
  8. Make › The same number again
Start lesson

Trust

Share a key without sending it, spot a changed message with a checksum, and prove who you are with a challenge that changes every time.

6Agreeing a key in the openNot started

Both ends need the same key, but anything sent by radio is public. Each end mixes a private number with public numbers, swaps the mixes, and both arrive at the same key without it ever being sent.

  1. Predict
  2. Run
  3. Investigate › Mixes and keys
  4. Investigate › What goes across
  5. Investigate › Why the toy numbers are weak
  6. Modify
  7. Make
Start lesson
7Has the message changed?Not started

A checksum is a small number worked out from a message and sent with it. If the number the receiver works out is different, the message was damaged or changed on the way.

  1. Predict
  2. Run
  3. Investigate › Working it out
  4. Investigate › Swapped letters
  5. Investigate › A deliberate change
  6. Modify
  7. Make
Start lesson
8Prove it with a challengeNot started

A password sent again and again is the same every time. A challenge that changes each time makes each answer good for one use only.

  1. Predict
  2. Run
  3. Investigate › Working out an answer
  4. Investigate › An answer heard before
  5. Investigate › What crosses the air
  6. Modify
  7. Make
Start lesson

Defend the system

Solve capture-the-flag puzzles, then find the weaknesses in a radio door lock and fix each one.

9Capture the flagNot started

Solve three puzzles that use the ciphers and checks you have built. Each answer is a flag you type in to prove you solved it.

  1. Predict
  2. Run
  3. Investigate › Puzzle 1: Caesar
  4. Investigate › Puzzle 2: XOR
  5. Investigate › Puzzle 3: checksum
  6. Make
Start lesson
10Defend the door lockNot started

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)