## Monday, September 8, 2008

### Fun with Functions

Cryptography is an interesting application of functions. A cipher allows you to take text (for example) and encrypt it into a new form of information that can then be transmitted. Most children learn a particularly simple cipher that is called a substitution cipher. Such a cipher does a direct translation of letter for letter. Below is a simple example, motivated by the "stage-appearance" of the letters in the phrase "The quick brown fox jumps over the lazy dog."

Other simple ciphers include shifting the alphabet a fixed number of letters or reversing the alphabet.

If we think of encrypting a message as being a function from character sequences to new character sequences, then we might imagine applying two different encryptions one after the other. This is function composition. Or we might want to decrypt a message. This is applying the inverse function. In particular, note that for an encryption method to be useful, the inverse must exist. That is, the function must be one-to-one.

Here is a message that I constructed using the QUICKBROWN cipher (above) followed by a shift cipher where an A becomes an R. Have fun!

JLWH EL MBSJ KJ LPMGK VGLHSM ZOG DCSX TGKHL.