Crypto and kids

I was nerd-sniped (reference from xkcd) by a colleague who wanted to do a cryptographic game for his kids, for a birthday party. The idea was to have a device to allow the kids to encrypt / decrypt a message

Principle

It’s using the Caesar cipher, which is a simple shift cipher. It’s super unsafe with short password (subject to basically any kind of statistical attack), but surprisingly, if the password is perfectly random and as long as the message, it’s perfect.

The principle is to have a secret message, use a password to get a ciphered message. Write the secret message, keeping only letters, write the password, repeating as many times as is required.

ILIKECHEESE --> secret message: I like cheese
COMTECOMTEC --> password : comté

For each column, forming a tuple of letters, the password indicates how many the offset of shift. A means no shift, B means shit by 1, C means shift by 2 and so on. See examples:

message:  ABC ABC ABC
password: AAA BBB ABC
cipher:   ABC BCD ACE

Realization

The idea is to use 3 concentric sets of letters, on 2 disks:

  • external one, on bottom disk, contains the encrypted letter
  • intermediate one, on upper disk, contains the clear text letters
  • internal one, on bottom disk, contains the password letters

The upper disk also has a small window showing a single password letter.

To encrypt or decrypt:

  • write text and password aligning letters
  • turn the upper disk to see the password letter in the window
  • if encrypting find the clear letter (inner circle) and read the encrypted one (outter circle)
  • if decrypting, just do the opposite

Taking the previous example

text:     ILIKECHEESE
password: COMTECOMTEC
result:   KZUDIEVQXWG

Maker:S,Date:2017-12-22,Ver:6,Lens:Kan03,Act:Lar02,E-Y

Realization is pretty simple, just print and use a fastener to have an axis. My prototype uses a resistor, cause I had one lying on the desk, but you can basically use anything. You probably should want to print on thicker paper and maybe use colors (green for clear text, red for encrypted for example).

After testing with the kids, this is what my second iteration gave:

Maker:S,Date:2017-12-22,Ver:6,Lens:Kan03,Act:Lar02,E-Y

As usual, the design is done in inkscape and you can find both the work file and the file to directly print on my bitbucket repository. I also created a grid that (displayed above) that can be used for helping with the encryption. Another common alternative is to print a table, with horizontal being the text and vertical being the password. First table is the encryption, second is the decryption (I find it less fun than the rotation device)

  ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ
A ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFG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EFGHIJKLMNOPQRST GHIJKLMNOPQRSTUVWXYZABCDEF
V VWXYZABCDEFGHIJKLMNOPQRSTU FGHIJKLMNOPQRSTUVWXYZABCDE
W WXYZABCDEFGHIJKLMNOPQRSTUV EFGHIJKLMNOPQRSTUVWXYZABCD
X XYZABCDEFGHIJKLMNOPQRSTUVW DEFGHIJKLMNOPQRSTUVWXYZABC
Y YZABCDEFGHIJKLMNOPQRSTUVWX CDEFGHIJKLMNOPQRSTUVWXYZAB
Z ZABCDEFGHIJKLMNOPQRSTUVWXY BCDEFGHIJKLMNOPQRSTUVWXYZA

Lessons learnt

Very small project but quite fun:

  • I ended up writing some code to encrypt / decrypt longer text (pretty straightforward)
  • You can make a lot of different ciphers by just reordering one of the disk. The cipher won’t be safer, but you can make an infinity of variants (or probably 26!)
  • My kids are second grader, it’s still really hard for them
  • Pretty easy to do for a beginner in inkscape

Famous last words: QTJVPBGLLBUTEHXASI (password: FLORENT)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s