2
$\begingroup$

How do you crack a long Vigenère cypher when the key is unknown? I have tried frequency analysis, but I'm not making any progress.

$\endgroup$
1
  • 1
    $\begingroup$ Frequency analysis would be one way, but brute forcing would be a better option for such a small key. If you want to automate, check words against a dictionary (with a computer or manually). $\endgroup$
    – Maarten Bodewes
    Commented Nov 16, 2019 at 0:45

3 Answers 3

3
$\begingroup$

Cracking a Vigenere cipher usually involves the below 3 steps:

  1. The Friedman Test - The first thing you need is the length of the key (approximately at least). You can do this by finding the Index of Coincidence (IoC). Since Vigenere cipher is a polyalphabetic substitution cipher, its IoC should be near 0.038 for a given piece of cipher text. This is pretty nice webpage about IoC, its significance and how to calculate it. Once you have the IoC calculated, you can find the length of the key from the IoC by using the formula given in this document.

  2. Splitting the text and Frequency Analysis - Once you have the key length (say $l$), split the entire cipher text into multiple rows with $l$ columns. Now, each column here can be taken as a shift cipher. Frequency analysis can be used for an individual column to figure out the shift for that column. For example, if the frequency of the letter 'c' is the most in a column, then it is probably substituted for 'e' and so the shift here will be 2. Since the shift is 2, the key for this particular column is the letter 'b'. Likewise there will be $l$ shift ciphers with $l$ individual keys for each column or shift cipher. These $l$ keys will make the actual key of the Vigenere cipher.

  3. Using the key to decrypt the entire text - After we compute the key, we can use it to shift the remaining of the text in each column (as is done in the encryption method of the Vigenere cipher). We will then combine the rows to get back the plaintext.

Note that you might have to perform the 2nd step multiple times since Frequency Analysis might not always give the right answer on the first shot.

Alternatively, after the first step, you can use the length of the key here to decrypt your cipher text in an automated way if you don't want to go through the hassles of step 2 and 3.

Hope this helps!

$\endgroup$
2
$\begingroup$

How is your frequency analysis failing? Is your comparison to the letter frequency of the English alphabet?

If the text is not normal English it may have non-standard letter frequencies. I therefore suggest to first find a shift between the columns to make the distribution most similar to each other and only then try to shift them together to crack the cipher.

$\endgroup$
0
$\begingroup$

If the key is length 2 then you have two Caesar ciphers interleaved, one for the odd numbered characters and one for the even.

Separate out odd and even characters into two separate strings. Then for each string run down the alphabet, testing each of the 25 possible Caesar keys. Find that one or two that best match normal English letter frequencies for odd, and one or two for even.

Combine each odd possible key with each even possible key to give you a short list of possible 2 character Vigenère keys. Try them in turn to see which one is correct, starting with the pairs that gave better scores on the frequency test.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.