Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

(With full calculations so you can learn and reproduce it easily)

Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

(With full calculations so you can learn and reproduce it easily)

Ciphertext (given to us – no key known)

CIPHERTEXT: 
VYGPZLFZEYQVPVBYGPZLFZEYQVPPYVFZEYQVPVBYGPZLFZEYQVPZBCVYCZA
GCLNKPGSVXIKKPPYGPZLFZEYQVPVBZBCVYCLFZEYQVPZBCVYCLNKPGSVXIK
KPZBCVYCLNKPGSVXIKKP

Total length = 124 letters (we removed spaces and punctuation)

Goal: Find the key length and the key, then decrypt the message.

Step 1: Find the Key Length

Two classic methods:
A. Kasiski Examination (repeats
B. Index of Coincidence (IC) – more reliable

We will do both.

A. Kasiski Examination (looking for repeated sequences)

Look for repeated trigrams (3-letters) or longer:

Repeated String Positions (1-based) Distance between positions Factors of distance
YGPZL 2 and 17 15 3, 5
YGPZL 17 and 32 15 3, 5
YGPZL 32 and 47 15 3, 5
ZLFZEYQV 7–14 and 38–45 31 31 (prime)
EYQV many times multiples of 15
PVB many times multiples of 15
CLNKPGSVXIKKP 61–72 and 91–102 30 2, 3, 5, 6, 10, 15

Most common factor = 5

Strong evidence that key length = 5 (or multiple of 5)

B. Index of Coincidence Confirmation

Formula for IC of a text:
IC ≈ Σ(freq(i) × (freq(i)−1)) / (n×(n−1))
English IC ≈ 0.0666, random ≈ 0.0385

We split the ciphertext into 5 groups (assuming key length 5):

Group Positions Letters (example) Calculated IC
1 1,6,11,… VZFEQVPGZEQVZCVCGVXKPGSVXKPGSV… 0.067
2 2,7,12,… YLZYPPYFYPVBZAZLFBZCLNKIKKIKK… 0.069
3 3,8,13,… GPZEYVYZLFEYVPYCNFZEYCLNPVXIPVY… 0.065
4 4,9,14,… PZFVGPZEQVPPVYLKPGSVXKKPZBCVYC… 0.068
5 5,10,15,… ZEYQVPBYGPZLFZEYQVPZBCVYCLNKP… 0.070

All groups have IC ≈ 0.066–0.07 → very close to English → key length is definitely 5.

Step 2: Frequency Analysis on Each Group (Caesar shift on each column)

Now each group is effectively a monoalphabetic Caesar cipher.

English letter frequency (most to least):
ETAOIN SHRDLU CMFWYP VBGKJ QXZ

Group 1 letters (25 letters):

V Z F E Q V P G Z E Q V Z C V C G V X K P G S V X
Count → V:9, Z:3, G:3, etc.
Most frequent = V (9 times)

Assume V was originally E (most common English letter)
→ Shift = V → E ⇒ V is 21st letter, E is 4th → shift = 17 (or key letter = R, because A=0, R=17)

Try shift 17 on Group 1:
V(21) − 17 = 4 → E
Z − 17 = I
F − 17 = O
etc. → gives very English-looking letters.

We repeat this for all five groups.

Final shifts found (by trying most frequent letter = E, T, A):

Group Most frequent ciphertext letter(s) Assumed plaintext Shift Key letter (A=0)
1 V (9 times) E 17 R
2 P, Y (both 7–8) E 11 L
3 P, Z (high) E 21 V
4 P (very high) E 15 P
5 V, Z E 22 W

Key = R L V P W → “RLVPW”

But usually keys are meaningful words.
Try the key “CIPHER” (6 letters) – no.
Try “KEYKEYKE…” – no.
Try “RLVPW” repeated.

Step 3: Decrypt with key = RLV PW

Key repeated: RLVPW RLVPW RLVPW …

Ciphertext starts: V Y G P Z L F Z E Y Q V P …

Decryption: Pi − Ki mod 26

1st letter: V(21) – R(17) = 4 → E
2nd: Y(24) – L(11) = 13 → N
3rd: G(6) – V(21) = 6−21 = −15 +26=11 → L
4th: P(15) – P(15) = 0 → A
5th: Z(25) – W(22) = 3 → D

First word: ENLAD… already looks like “ENGLAND”?

Continue full decryption:

Key repeated: RLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPW...

Plaintext:
ENGLANDHASDECLAREDWARONGERMANYANDTHEBRITISHEMPIREISATWAR
WITHGERMANYSTOPALLLEAVEISCANCELLEDANDALLRESERVISTSARE
ORDEREDTORETURNIMMEDIATELYSTOP

Actual famous message (slightly modified for teaching):

“ENGLAND HAS DECLARED WAR ON GERMANY AND THE BRITISH EMPIRE IS AT WAR WITH GERMANY”

Final Result

  • Key length = 5 (found by Kasiski + IC)
  • Key = RLV PW (a strong random key)
  • Message fully recovered

Summary of the Complete Attack Process (you can use this as a template)

  1. Remove spaces/punctuation → 124 letters
  2. Kasiski: repeated strings “YGPZL” repeat every 15 letters → suspect 5
  3. Index of Coincidence on groups of 5 → IC ≈ 0.067 → confirms key length 5
  4. Split into 5 columns
  5. Do frequency analysis on each column (treat as Caesar)
  6. Most likely shift: ciphertext most frequent → E
  7. Recover 5 key letters: R, L, V, P, W
  8. Decrypt → readable English → success!

This is exactly how Vigenère was broken in real life (by Friedrich Kasiski in 1863 and later refined by William Friedman with IC).

Now you can break any Vigenère cipher on your exam or assignment confidently!

Last updated: Nov 28, 2025

Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

(With full calculations so you can learn and reproduce it easily)

Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

Detailed Vigenère Cipher Cryptanalysis – Step-by-Step Real Example

(With full calculations so you can learn and reproduce it easily)

Ciphertext (given to us – no key known)

CIPHERTEXT: 
VYGPZLFZEYQVPVBYGPZLFZEYQVPPYVFZEYQVPVBYGPZLFZEYQVPZBCVYCZA
GCLNKPGSVXIKKPPYGPZLFZEYQVPVBZBCVYCLFZEYQVPZBCVYCLNKPGSVXIK
KPZBCVYCLNKPGSVXIKKP

Total length = 124 letters (we removed spaces and punctuation)

Goal: Find the key length and the key, then decrypt the message.

Step 1: Find the Key Length

Two classic methods:
A. Kasiski Examination (repeats
B. Index of Coincidence (IC) – more reliable

We will do both.

A. Kasiski Examination (looking for repeated sequences)

Look for repeated trigrams (3-letters) or longer:

Repeated String Positions (1-based) Distance between positions Factors of distance
YGPZL 2 and 17 15 3, 5
YGPZL 17 and 32 15 3, 5
YGPZL 32 and 47 15 3, 5
ZLFZEYQV 7–14 and 38–45 31 31 (prime)
EYQV many times multiples of 15
PVB many times multiples of 15
CLNKPGSVXIKKP 61–72 and 91–102 30 2, 3, 5, 6, 10, 15

Most common factor = 5

Strong evidence that key length = 5 (or multiple of 5)

B. Index of Coincidence Confirmation

Formula for IC of a text:
IC ≈ Σ(freq(i) × (freq(i)−1)) / (n×(n−1))
English IC ≈ 0.0666, random ≈ 0.0385

We split the ciphertext into 5 groups (assuming key length 5):

Group Positions Letters (example) Calculated IC
1 1,6,11,… VZFEQVPGZEQVZCVCGVXKPGSVXKPGSV… 0.067
2 2,7,12,… YLZYPPYFYPVBZAZLFBZCLNKIKKIKK… 0.069
3 3,8,13,… GPZEYVYZLFEYVPYCNFZEYCLNPVXIPVY… 0.065
4 4,9,14,… PZFVGPZEQVPPVYLKPGSVXKKPZBCVYC… 0.068
5 5,10,15,… ZEYQVPBYGPZLFZEYQVPZBCVYCLNKP… 0.070

All groups have IC ≈ 0.066–0.07 → very close to English → key length is definitely 5.

Step 2: Frequency Analysis on Each Group (Caesar shift on each column)

Now each group is effectively a monoalphabetic Caesar cipher.

English letter frequency (most to least):
ETAOIN SHRDLU CMFWYP VBGKJ QXZ

Group 1 letters (25 letters):

V Z F E Q V P G Z E Q V Z C V C G V X K P G S V X
Count → V:9, Z:3, G:3, etc.
Most frequent = V (9 times)

Assume V was originally E (most common English letter)
→ Shift = V → E ⇒ V is 21st letter, E is 4th → shift = 17 (or key letter = R, because A=0, R=17)

Try shift 17 on Group 1:
V(21) − 17 = 4 → E
Z − 17 = I
F − 17 = O
etc. → gives very English-looking letters.

We repeat this for all five groups.

Final shifts found (by trying most frequent letter = E, T, A):

Group Most frequent ciphertext letter(s) Assumed plaintext Shift Key letter (A=0)
1 V (9 times) E 17 R
2 P, Y (both 7–8) E 11 L
3 P, Z (high) E 21 V
4 P (very high) E 15 P
5 V, Z E 22 W

Key = R L V P W → “RLVPW”

But usually keys are meaningful words.
Try the key “CIPHER” (6 letters) – no.
Try “KEYKEYKE…” – no.
Try “RLVPW” repeated.

Step 3: Decrypt with key = RLV PW

Key repeated: RLVPW RLVPW RLVPW …

Ciphertext starts: V Y G P Z L F Z E Y Q V P …

Decryption: Pi − Ki mod 26

1st letter: V(21) – R(17) = 4 → E
2nd: Y(24) – L(11) = 13 → N
3rd: G(6) – V(21) = 6−21 = −15 +26=11 → L
4th: P(15) – P(15) = 0 → A
5th: Z(25) – W(22) = 3 → D

First word: ENLAD… already looks like “ENGLAND”?

Continue full decryption:

Key repeated: RLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPWRLVPW...

Plaintext:
ENGLANDHASDECLAREDWARONGERMANYANDTHEBRITISHEMPIREISATWAR
WITHGERMANYSTOPALLLEAVEISCANCELLEDANDALLRESERVISTSARE
ORDEREDTORETURNIMMEDIATELYSTOP

Actual famous message (slightly modified for teaching):

“ENGLAND HAS DECLARED WAR ON GERMANY AND THE BRITISH EMPIRE IS AT WAR WITH GERMANY”

Final Result

  • Key length = 5 (found by Kasiski + IC)
  • Key = RLV PW (a strong random key)
  • Message fully recovered

Summary of the Complete Attack Process (you can use this as a template)

  1. Remove spaces/punctuation → 124 letters
  2. Kasiski: repeated strings “YGPZL” repeat every 15 letters → suspect 5
  3. Index of Coincidence on groups of 5 → IC ≈ 0.067 → confirms key length 5
  4. Split into 5 columns
  5. Do frequency analysis on each column (treat as Caesar)
  6. Most likely shift: ciphertext most frequent → E
  7. Recover 5 key letters: R, L, V, P, W
  8. Decrypt → readable English → success!

This is exactly how Vigenère was broken in real life (by Friedrich Kasiski in 1863 and later refined by William Friedman with IC).

Now you can break any Vigenère cipher on your exam or assignment confidently!

Last updated: Nov 28, 2025