History
Caesar Cipher - 50 BC
- each letter shifts by 3
- letters are numbered
A=0, B=1, ... Z=25(zero-indexed) for the shift math
flowchart LR
subgraph Plaintext
a["a = 0"]
b["b = 1"]
c["c = 2"]
end
subgraph "Ciphertext (shift +3)"
d["d = 3"]
e["e = 4"]
f["f = 5"]
end
a --> d
b --> e
c --> f
Vigener Cipher - 1553
- like Caesar, but the shift amount changes per letter, based on a repeating keyword
- e.g. word
HELLOWORLDwith keyLEMONrepeated 2x (LEMONLEMON):H+L->S,E+E->I,L+M->X - if the sum is 26 or more, wrap around with
% 26— e.g.O+N->14 + 13 = 27,27 % 26 = 1->B
1 2 3 4 5 6 7 8 9 10
Plaintext H E L L O W O R L D
(value) 7 4 11 11 14 22 14 17 11 3
Key L E M O N L E M O N
(value) 11 4 12 14 13 11 4 12 14 13
--------------------------------------------------------------
Sum 18 8 23 25 27 33 18 29 25 16
mod 26 18 8 23 25 1 7 18 3 25 16
Ciphertext S I X Z B H S D Z Q
Hebern Machine (Rotor Machine) - 1917-1943
- a single rotor with a hard-wired substitution
- the rotor advances by 1 position after every keystroke, so the shift increases by 1 each letter (like Caesar, but the shift itself shifts)
- e.g. word
HELLOWORLD, shift starting at 0 and incrementing by 1 per letter:
1 2 3 4 5 6 7 8 9 10
Plaintext H E L L O W O R L D
(value) 7 4 11 11 14 22 14 17 11 3
Rotor shift 0 1 2 3 4 5 6 7 8 9
----------------------------------------------------------------
Sum 7 5 13 14 18 27 20 24 19 12
mod 26 7 5 13 14 18 1 20 24 19 12
Ciphertext H F N O S B U Y T M
Enigma (Rotor Machine) - 1918
- 3 rotors instead of 1, each stepping at a different rate; like an odometer (rightmost steps every keystroke, others less often)
- a reflector sends the signal back through the same 3 rotors — this makes the cipher self-inverse (same setting encrypts and decrypts), but also means a letter can never encrypt to itself (return trip can never land back on the same letter it started with), a flaw Allied codebreakers exploited
- a plugboard swaps pairs of letters before/after the rotors for extra permutation
- broken at Bletchley Park (Alan Turing et al.) during WWII
One letter's round trip through the machine:
Key --> Plugboard --> Rotor 1 --> Rotor 2 --> Rotor 3 --+
|
Reflector
|
Lamp <-- Plugboard <-- Rotor 1 <-- Rotor 2 <-- Rotor 3 <-+
Key Plug R1 R2 R3 Ref R3' R2' R1' Plug Lamp(letter cipher)
-------------------------------------------------------
A F G R W V L K B W W
B W B J T Z M O M M M
C C M W U C G R X X X
D D F I R B A A U U U
E E L H P I Q Q H H H
F A E S G L F W N N N
G G D K X J E Z J J J
H H Q Q I P H L E E E
I I V Y Q E P U R R R
J J Z E J X K D G G G
K K N T A Y O Y O O O
L L T N N K U H P P P
M M O M Z T J B W B B
N N W F L G S E A F F
O O Y O Y A T N K K K
P P H U K N N T L L L
Q Q X V M O Z S S S S
R R U P E Q Y V I I I
S S S Z O M V X Q Q Q
T T P C F S X I V V V
U U A A B R I F D D D
V V I X S F C P T T T
W B K L V W R G F A A
X X R G C U W M C C C
Y Y C D H D B J Z Z Z
Z Z J B D H D C Y Y Y
Key -> Lamp is one column per stage (R1'/R2'/R3' = the same rotors on the return trip, using their wiring in reverse). Reading the Key and Lamp columns together confirms the two properties from above: no row has Key == Lamp, and the mapping is reciprocal (A -> W and W -> A, B -> M and M -> B, etc.) — which is exactly why the same settings both encrypt and decrypt.
DES - 1974
- keys = 56-bit (2⁵⁶)
- block size = 64-bit (2⁶⁴)
AES - 2001
- keys = 128-bit (2¹²⁸)