Rotors of M-209 cipher machine.

Cryptographic Terminology

Basic Terms

We need to start by defining some fundamental terminology used to discuss cryptography and introducing the basics of encryption and decryption.


This is the original message. It could be simple text, or a JPEG image, or a zipped archive file, or whatever you want to protect. Sometimes this is called "cleartext".


This appears to be highly random, as the actual information contained in the plaintext has been hidden. The term in math or information theory is that the ciphertext has high entropy.


Encryption algorithm, a function applied to the plaintext to produce the ciphertext.


Encryption key, used to modify how E works on this one specific run. Keys are binary strings, or if you want to think of them another way, the big numbers that those binary strings could represent.


Decryption algorithm, a function applied to the ciphertext to produce the plaintext.


Decryption key, used to modify how D works on this one specific run.

Computationally difficult

Possible in theory, but a practical attacker will not have the time (or the motivation, or other needed resources) to carry out an exhaustive attack, nor will they be so lucky as to stumble upon the answer unexpectedly early. It's "hard enough" that it's not realistic to worry about an adversary solving this problem so quickly that they can use the result against us.

Codes and Ciphers

A code is a scheme for replacing words, names, and phrases. The result looks like the original language but the meaning is obscured.

A cipher operates at the level of individual bits. Historical ciphers operated on individual letters or small letter groups.

For example, the Imperial Japanese Navy used   EAST WIND, RAIN (in Japanese, of course) as a coded message to launch the attack on Pearl Harbor.

An enciphered version of   ATTACK PEARL HARBOR 7 DECEMBER   might look like  NAMKE PIRCI YEAXW GUOCY HIJXU AARUD.

Admiral Isoroku Yamamoto examining naval charts.

Admiral Isoroku Yamamoto, master strategist of the Imperial Japanese Navy.

Codes and ciphers are typically used in combination. The message is first modified by replacing specific terms, names, and locations by code words. The result is then enciphered.

For example, during World War II the Allies had broken the JN-25 cipher used by the Imperial Japanese navy. They could read the cleartext, but code words were used. The US knew that the Japanese fleet was going to attack a location referred to as "AF" in June 1942, but they did not know whether "AF" was code for Midway Island or a location in the Aleutian Islands.

Midway was instructed to transmit cleartext messages falsely reporting that their water desalination plant was broken. The Japanese fleet intercepted these and then sent messages that decrypted to the Japanese for "AF is short of water". That revealed the meaning of the code group "AF" and allowed the US to win the crucial Battle of Midway.

Next ❯ Symmetric and Asymmetric Ciphers