Caesar cipher · 03 Worked example

Caesar cipher: a worked example

Let us encrypt and decrypt VENI VIDI VICI with key 3, letter by letter.

Let us take the phrase attributed to Caesar after the victory at Zela, VENI VIDI VICI, and encrypt it with key 3 using the 26-letter alphabet.

Plain letterPosition (A=0)Position + 3Cipher letter
V2124Y
E47H
N1316Q
I811L
D36G
C25F

Applying the table to every letter we obtain:

encryption
VENI VIDI VICI   →   YHQL YLGL YLFL

Decryption

The recipient receives YHQL YLGL YLFL and knows the key is 3: he moves every letter three positions back. Y returns to V, H to E, Q to N, L to I, and the message reappears.

Wrapping around the alphabet

What happens to the last letters? With key 3, X (position 23) would become position 26, which does not exist: you start again from the beginning, so X becomes A, Y becomes B and Z becomes C. In mathematics this operation is called modulo 26, explained in its own page.

Continue with
04 The maths

Caesar cipher: the maths

Modular arithmetic, encryption and decryption formulas, key space: the Caesar cipher written as formulas.

↑