# Don't understand Vigenere cipher?

I don't understand why we could attack Vigenere cipher when we know the key's length? Can anyone give me a hint? Thank you very much?

we know caesar cipher is not that safe because we only need to try at most 25 keys in order to crack it. this is too easy even for a human to do.

text encrypted with vigenere is a little more difficult to decrypt because of the fact that each plain character is encrypted using different key and that the length of the whole key string is not known (though it can be easily identified by analyzing the patterns in the encrypted text).

if the length of the key string, n, is known, you need to try at most exactly 26n - 1 key configurations before you are able to decrypt the message.

in the example given in Nate's video on vigenere, if we know the length of the key (which is 5 in this case), we could have something like

``````_ _ _ _ _
``````

now each of the underscores can have 1 out of 26 character. so we got 26 × 26 × 26 × 26 × 26 (that's 265) possible permutations (from `a a a a a` to `z z z z z`). `b a c o n` (the key in this example) is definitely gonna be one of them.

given that `a a a a a` is not worth trying, we could say that we have to try at most 265 - 1 permutations before we can crack the cipher.

while this may take relatively long time to crack, it's still possible to do with a computer.