Here are 2 simple ways to introduce the idea of encryption to elementary school kids.
Ciphers
I had them try to decode the following code:
4 15 7
(with some prodding they eventually figured out it was a simple letter-number cipher spelling “dog”)
Mastermind
You might recognize this game from your own childhood.
You don’t need to buy it. You can play it with different color marbles, bingo chips, coins or almost any set of things lying around the house.
How to play:
-
- A codemaker constructs a hidden sequence of 4 different colored beads (out of a possible 6 colors).
- The codebreaker tries to guess the sequence by arranging 4 colors in order.
- The codemaker gives non-verbal feedback:
a) Identifies how many of the colors used are correct
b) Identifies how many beads are the right color AND in the right position - Repeat until the code is cracked
Enrichment questions:
How can the game be made easier?
How can the game be made harder?And if you have an older onlooker…how many possible codes can be created?
And if you have an Excel fan in the vicinity, see how you can solve such problems using the hypergeometric distribution. (A Reddit thread targeting game designers)
A Slightly More Advanced Example: Using a “Mask”
Suppose a group of people are sitting around a table and you all want to know how much money everyone makes but of course nobody is willing to share their own salary.
Here’s a way to uncover the average pay at the table without anybody needing to disclose their pay.
Let’s pretend A, B, C, and D are having dinner together at this table.
Just follow these steps:
Masking Phase
- Tell “A” to add an arbitrary number to their pay and write the sum on a piece of paper. It’s very important to write just the sum! So if A makes $100k per year and the arbitrary number is 5,000,000 then they would write: $5,100,000
- Pass the paper to “B”
- “B” notes the sum and adds it to their own salary plus their own arbitrary number. They write this sum on a fresh piece of paper and hand it to “C”. Important: use a new piece of paper, we don’t want anyone to see the history of how the sum was created.
Example:
“B” receives paper with the sum $5,100, 000
“B” add this to their own salary $50,000 plus an arbitrary number of $1,000,000
“B” passes a piece of paper with the total $6,150,000 to “D” - Repeat this process until the paper gets back to “A”
Un-masking Phase
- “A” subtracts their arbitrary number only from the total and passes the new total to “B”.
Example :
“A” receives a piece of paper with the number $9,000,000 written on it
“A” subtracts the $1,000,000 arbitrary number and passes the number $8,000,000 to “B” - Repeat until everyone has subtracted their arbitrary number.
The remaining total is the sum of everyone’s pay. If we divide by 4 (the number of people) we have discovered the average pay at the table and nobody needed to reveal their own number!
You have learned a simple way to “mask” data with arbitrary numbers!
Try it yourself. You don’t even need paper — just explain the rules to some friends in your texting group and find out if you are actually under or overpaid! Just don’t kill the messenger.
(The mask example was inspired by this Twitter thread by @theemilyaccount)