Breaking Secret Codes with Mathematica
Mathematica can make you feel like a computational superman. Armed with that attitude and some schoolboy knowledge of cryptography, I turned my attention to cipher breaking this week, only to discover buried kryptonite.
The weakness of ciphers (where you swap every occurrence of a particular letter in your message with the same different letter) is that they don't change the patterns of letters. The simplest attack that exploits this fact is frequency analysis. The most common letter in English is "e", and so it follows that the most common character in an encoded message (assuming the message is written in English) will correspond to "e". And so on through the alphabet.
Mary Queen of Scots famously lost her head when Queen Elizabeth's spymaster broke Mary's cipher using frequency analysis. I figured that if sixteenth century spies could do it by hand, I should be able to automate it in Mathematica in about 10 minutes.