Crypto-WheelLast time I changed job, it meant an increase in commute (from 5 minutes to an hour) which also meant I would not see my kids every morning. So I picked up the habit (since then lost mind you) of setting the table for their breakfast and leaving them a note, wishing them a good day. Who knew that from a simple note, things would evolve to teaching encryption.
Of course, the simple note grew old over time so I started looking for alternatives. After trying the multi-color notes and various “analog” mediums, I turned to Bamboo Paper on the iPad and that provide several options. I also played around with a Boogie Board Rip and that provided an interesting alternative for a few days but it was short lived.

The note content varied from day to day. Some days it was a short simple “Love you both!” and other morning it was a good way to relay important news like the score of the prior night’s Giant game.

After a visit at the International Spy Museum in Washington DC, I decided I could also use the morning note as a teaching tool and set out to teach them about encryption. I baptized my project the “Crypto-Wheel” but later realized the name of such a device is usually Cypher-Disk. The kids helped me as we a fabricated the wheel and we made several improvements over time.

So the concept and instructions were easy, easy enough for my kids to follow:

  • The KEY is set by indicating the letter in WHITE, lined up with the BLUE letter “Q”.
  • Make sure to properly set the wheel to the right KEY before use.
  • Always encrypt from BLUE to WHITE
  • Always decrypt from WHITE to BLUE.

The first message I left they struggled a bit with. But they quickly got the hang of it. As they improved, the messages got longer and longer.

After missing my first train, trying to properly encrypt a message for the kids, I decided I needed a way to quickly produce encoded messages. Using Python, I wrote a short script which allowed me to encrypt or decrypt based on the randomness of this wheel. The result works well:

$ ./crypto_wheel.py --key=A --text="THIS IS MY STRING" -e
Clear : THIS IS MY STRING
Encrypted: GPXE XE QT EGCXSL

$ ./crypto_wheel.py --key=A --text="GPXE XE QT EGCXSL" -d
Encrypted: GPXE XE QT EGCXSL
Clear : THIS IS MY STRING

The script uses a rotate_string() function:

def rotate_string(alpha,spaces):
    letters = ['']
    for c in alpha:
        a = ord(c) - 65
        a = (a + spaces)%26 + 65
        a = chr(a)
        letters.append(a)
    return ''.join(letters)

And the letters used in the translation are rotated prior based on the key:

try:
        if (len(key) == 1):
            # Key is "White in front of Blue Q"
            spaces =  ord(key) - ord("A")
            letters = rotate_string(letters, spaces)

I dropped a full copy of the script at Github.

Meanwhile, my own use of the wheel has reduced as my habit of leaving notes did. This is probably something I should resume soon as it is a fun way to communicate with kids, teach them a thing or two and leave them with something fun before they’re off to school.

You can find more information on encryption for kids at NSA’s CryptoKids.