Introduction

Generally, solving a Vigenère ciphertext requires first finding the key length, then finding the specific key. I have already given you the key length, so we need to use that information to find the key.

This page will walk you through the process of analyzing a Vigenère ciphertext when you don't know the key. At the bottom of the page is a tool to help you work one out.

Write the Ciphertext

Suppose the ciphertext message was "IAL OU IPP IYL WRDQTPKM GVDPN QD RBNA PDAQEGWF PS HJKS Y XVZGGPKP, EIBK PTDXWC XBU'T VD QYRI TVVTGVXCHG." and we know the length of our key is 9 characters, even though we don't know the key itself.

The Vigenère encryption process is handled by repeating a key the length of the plaintext. Knowing this, we can use this to recover the key. This is done by getting every n-th character of the ciphertext.

Divide the Ciphertext

Because Vigenère ciphertexts are encreated with a repeating key, if the key is 9 characters long, then every 9th character will be encrypted with the same key character. Which means, the Vigenère ciphertext is really just 9 cryptograms in this scenario.

This means that we need to divide up the ciphertext every 9th character, so we can find out which key character was used to encrypt those ciphertext characters.

Using our ciphertext from above, writing down every 9th character would look as follows:

```I        Y        M        B        W        X        I        X        I        H
A        L        G        N        F        V        B        B        T        G
L        W        V        A        P        Z        K        U        V
O        R        D        P        S        G        P        T        V
U        D        P        D        H        G        T        V        T
I        Q        N        A        J        P        D        D        G
P        T        Q        Q        K        K        X        Q        V
P        P        D        E        S        P        W        Y        X
I        K        R        G        Y        E        C        R        C
```

This gives us the following 9 shorter ciphertexts, each uniquely encrypted with a character from our key:

```IYMBWXIXIH (1st key character)
ALGNFVBBTG (2nd key character)
LWVAPZKUV  (3rd key character)
ORDPSGPTV  (4th key character)
UDPDHGTVT  (5th key character)
IQNAJPDDG  (6th key character)
PTQQKKXQV  (7th key character)
PPDESPWYX  (8th key character)
IKRGYECRC  (9th key character)
```

Decrypting Each String

Knowing that English characters have a certain frequency in the language, we can take advantage of this to help determine what character encrypted each string. This is done by decrypting each string with all 26 characters, and comparing how the characters in the proposed decrypted string compare with English language.

If the decrypted string has a similar frequency as the English language, then we can be reasonably sure we found the right character to decrypt that string. To do this, we use the chi-square test.

The chi-square test compares the character frequency to what we expect. The result is a number, and the lower the number, the more likely it behaves like English text.

So, starting with our first string of "IYMBWXIXIH", it gets decrypted 26 times, with every letter of the alphabet, then calculated using the chi-square test:

```A: IYMBWXIXIH: 291.39     N: VLZOJKVKVU: 341.77
B: HXLAVWHWHG: 107.28     O: UKYNIJUJUT: 306.11
C: GWKZUVGVGF: 236.00     P: TJXMHITITS: 145.08
D: FVJYTUFUFE: 127.44     Q: SIWLGHSHSR: 25.58
E: EUIXSTETED: 77.16      R: RHVKFGRGRQ: 159.45
F: DTHWRSDSDC: 29.73      S: QGUJEFQFQP: 1035.24
G: CSGVQRCRCB: 157.77     T: PFTIDEPEPO: 50.52
H: BRFUPQBQBA: 487.57     U: OESHCDODON: 20.48
I: AQETOPAPAZ: 265.38     V: NDRGBCNCNM: 37.56
J: ZPDSNOZOZY: 1227.21    W: MCQFABMBML: 171.27
K: YOCRMNYNYX: 118.94     X: LBPEZALALK: 178.02
L: XNBQLMXMXW: 726.79     Y: KAODYZKZKJ: 722.45
M: WMAPKLWLWV: 71.82      Z: JZNCXYJYJI: 806.81
```

The "U" character is the lowest value, so it seems reasonable that every 9th letter in our ciphertext, starting at the first character, was encrypted with "U".

Repeating the process for all 9 key character strings, we get the following result: "UNHLPPXLK".

This shows that this process for finding all the key characters isn't bullet-proof. By trial-and-error with "UNHLPPXLK" as our key, and decrypting portions of the text, we eventually learn that the key is really "UNHAPPILY" and the original message as "ONE OF THE KEY PROBLEMS TODAY IS THAT POLITICS IS SUCH A DISGRACE, GOOD PEOPLE DON'T GO INTO GOVERNMENT."