Originally published by Robert Beisert at fortcollinsprogram.robert-beisert.com

Codes and the Art of Encryption

Siht ekil egassem a uoy evig ot erew I esoppus.

Could you read that message? I’d be willing to bet that you were able to retrieve the information stored in the above string of characters in a few seconds. However, it likely took you just a bit longer than it would have taken had I written it out normally.

Welcome to the world of Encryption – hiding meaningful data from casual observation.

Why Encrypt Information?

Have you ever known something that you wanted to share with your best friend, but you didn’t want anyone else to overhear? Or have you ever wanted to give your credit card information to Amazon without giving it away to everyone else on the internet? In both of these cases, you had some information you wanted to keep confidential (secret).

Encryption techniques have been employed for centuries for just such tasks. Julius Caesar was famous for a simple substitution cipher which would protect his orders and information from enemy interception. The Germans developed the Enigma device to protect information from falling into Allied hands. Native Americans used smoke signals to coordinate attacks and share important information with nearby tribesmen.

Basically, if there’s anything you don’t want to share with just about everyone, you want to encrypt that information.

Easy Encryptions

Because encryption predates the computer by millennia, it seems only natural that many of the classic encryptions can be done by hand.

First and most obvious is the substitution cipher. With substitutions, you replace one piece of information with another in a way that (in theory) only the intended recipient can correct. Such substitutions include the Caesar cipher, where you shift the entire alphabet by some amount and replace all the letters, and the Playfair cipher, where you break your sentences down into pairs and replace those pairs using a set of rules and a special translation table. It also includes the book ciphers for which the KGB was famous – they’d give page and word numbers which could be pulled from a chosen “code book” and translated back.

After substitution ciphers, we have permutation or scramble ciphers. These ciphers move things around so that a meaningful message is replaced with gibberish. While few simple examples of permutation ciphers exist, we could propose a cipher that works like this:

  1. Break your sentence(s) up into 4×4 grids, filling horizontally before vertically
    1. If you have empty space at the end of the grid, fill this in with the letter “e”
  2. Shift each row a number of times equal to the row number (starting at 0)
  3. Shift each column a number of times equal to the column number (starting at 0)
  4. Copy it out backwards

Based on this technique, a string like “Hello World” could be translated like this:

H e l l

o W o r

l d e e

e e e e

…………………..

Hell

Woro

eeld

eeee

………….

Hole

Weel

eelo

eerd

………………

holeweeleeloeerd

………………

dreeoleeleeweloh

If you didn’t know how our cipher worked, the phrase “dree olee leew eloh” wouldn’t mean much to you, would it?

photo by: