We need to start by defining the fundamental terminology used to discuss cryptography and introducing the basics of encryption and decryption.
Eworks 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.
Dworks on this one specific run.
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 for the execution of the attack on
An enciphered version of
ATTACK PEARL HARBOR 7 DECEMBER
might look like
NAMKE PIRCI YEAXW GUOCY HIJXU AARUD.
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