##### Cracking Codes and Cryptograms For Dummies

Cryptography today has evolved into a complex science (some say an art) presenting many great promises and challenges in the field of information security. The basics of cryptography include classes and types of ciphers — cryptographic transformations — various terms and concepts, and the individual components of the cryptosystem.

The two basic types of ciphers are substitution and transposition. Both are involved with the process of transforming plaintext (the intended message) into ciphertext (the encrypted message).

## Substitution ciphers

Substitution ciphers replace bits, characters, or character blocks in plaintext with alternate bits, characters, or character blocks to produce ciphertext. A classic example of a substitution cipher is one that Julius Caesar used: He substituted letters of the message with other letters from the same alphabet. In a simple substitution cipher using the standard English alphabet, a cryptovariable (key) is added modulo 26 to the plaintext message. In modulo 26 addition, you subtract 26 from any sum greater than 26 (or add 26 to any value less than 1) to achieve the encrypted/decrypted numeric value. For example, a basic substitution cipher in which the word BOY is encrypted by adding three characters using modulo 26 math produces the following result:

B O Y PLAINTEXT
2 15 25 NUMERIC VALUE
+3 3 3 SUBSTITUTION VALUE
5 18 2 MODULO 26 RESULT
E R B CIPHERTEXT

A substitution cipher may be monoalphabetic or polyalphabetic:

• Monoalphabetic: A single alphabet is used to encrypt the entire plaintext message.
• Polyalphabetic: A more complex substitution that uses a different alphabet to encrypt each bit, character, or character block of a plaintext message.

A more modern example of a substitution cipher is the S-boxes (Substitution boxes) employed in the Data Encryption Standard (DES) algorithm. The S-boxes in DES produce a nonlinear substitution (6 bits in, 4 bits out). Note: Do not attempt to sing this to the tune "Shave and a Haircut" to improve the strength of the encryption by hiding any statistical relationship between the plaintext and ciphertext characters.

## Transposition (or permutation) ciphers

Transposition ciphers rearrange bits, characters, or character blocks in plaintext to produce ciphertext. In a simple columnar transposition cipher, a message might be read horizontally but written vertically to produce the ciphertext as in the following example:

THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG

is written in 9 columns as

THEQUICKB
ROWNFOXJU
MPEDOVERT
HELAZYDOG

and then transposed (encrypted) vertically as

TRMHHOPEEWELQNDAUFOZIOVYCXEDKJROBUTG

The original letters of the plaintext message are the same; only the order has been changed to achieve encryption.

DES performs permutations through the use of P-boxes (Permutation boxes) to spread the influence of a plaintext character over many characters so that they're not easily traced back to the S-boxes used in the substitution cipher.

Other types of ciphers include

• Codes: Includes words and phrases. For example:
Ciphertext: "Colonel Jessup, did you order the Code Red!?"
Plaintext: "Did you order the attack!?"
• Running (or book) ciphers: For example, the key is page 137 of The Catcher in the Rye, and text on that page is added modulo 26 to perform encryption/decryption.
• Vernam ciphers: Also known as one-time pads, which are random keystreams that can only be used once. Both the sender and receiver have the same one-time pad that contains a keystream that is the same length as the message to which it is replied. Vernam ciphers are considered unbreakable because they are totally random and each keystream is used only once (hence the name one-time pad) and then thrown away.
• Concealment ciphers: These include steganography, in which the message itself isn't encrypted, but the very existence of the message is concealed within some other medium, such as over digital traffic noise or in a digital image.

Most modern cryptosystems use both substitution and transposition/permutation to achieve encryption.