Tim Trott.ninja { color:black; visibility:hidden; }

# Introduction to Cryptography

By , Sunday 17th April 2011 in Security & Privacy

Derived from two Greek words, krypto meaning "hidden" and grafo "to write", cryptography is a mechanism to hide information from unauthorised viewing.

Cryptography was made famous by the German Enigma cipher, used in World War II for encryption of very high-level general staff messages and the subsequent decryption at Bletchley Park, UK. Cryptography now widely used in everyday life from credit cards to browsing the internet.

Cryptography dates back to ancient Mesopotamia where clay tablets show encrypted recipes, while around 5-600BC Hebrew scholars made use of simple monoalphabetic substitution ciphers. A cipher is an algorithm for performing encryption and decryption.

### Monoalphabetic Substitution

A very simple monoalphabetic substitution cipher would involve one step performed on the original text where letters are substituted. For example ROT13 is a Caesar cipher where the alphabet is rotated 13 steps.

`A B C D E F G H I J K L M N O P Q R S T U V W X Y Z`
becomes
`N O P Q R S T U V W X Y Z A B C D E F G H I J K L M`

Using this lookup the string "Hello World" will become "Urxxa Jadxq". Quite meaningless to anybody who happens to find the encrypted text, but it is still very easy to crack.

A more secure ciper uses a passphrase to generate the substitution alphabet, where a secret password is chosen, duplicate letters removed and the rest of the alphabet filled in.

For example, a password of novembers becomes novembrs and our new substitution alphabet is:

`A B C D E F G H I J K L M N O P Q R S T U V W X Y Z`
becomes
`N O V E M B R S A C D F G H I J K L P Q T U W X Y Z`

Using this new cipher "Hello World" becomes "Smddi Wilde", which can only be decrypted once the password has been cracked.

Other substitution ciphers can involve substituting numbers or symbols or even pictures (pigpen cipher) to encode text.

### Polyalphabetic Substitution

As the name suggests polyalphabetic substitution involves more than one substitution alphabet and is substantially more difficult to crack. Multiple alphabets are created and stored in a tableau, usually 26 alphabets of 26 letters. Then, a password or passphrase is chosen and a string encrypted using the alphabet corresponding to the letters of the password. For example a password of TODAY would involve using the T alphabet to find the first letter of the cipher text, the O alphabet for the seconds, D for the third and so on. After the Y alphabet has been used revert back to T and start again.

### Mechanical substitution ciphers

The most important and famous mechanical cipher machine was the Enigma device used by the Germans, but also includes devices used by the allies called SIGABA and Typex. These were rotor ciphers where the substituted letter was chosen electrically from a huge number of possible combinations resulting from the rotation of several letter disks. Since one or more of the disk rotated mechanically with each plaintext letter enciphered, the number of alphabets used was substantially more than astronomical.

### Modern cryptography

With the advent of modern computers and processing more secure cipher algorithms evolved. From a sufficiently abstract perspective, modern bit-oriented block ciphers (eg, DES, or AES) can be viewed as substitution ciphers on an enormously large binary alphabet (in the case of 256-bit encryption this equates to alphabets 256256 in length, but doesn't quite work like that).