I came across the idea of using multiple Vigenere keys of coprime lengths here. The idea is, what if you use multiple keys, whose lengths are all co-prime? Then your effective key length would be the product of the length of all keys since they never line up with each other until that point.

It would be fantastic for key management since with keys of lengths 29, 31, and 37, your effective key length would be over 33,000! You could reuse them for many messages as long as you keep track of effective key length usage.

How would one go about cracking such a ciphertext, when its length is shorter than the product of N keys, whose lengths are all co-prime?

I posted this same question on Reddit here and got this apparent solution, but it's too vague for me to follow since the author didn't have the time to go into more detail.

  • $\begingroup$ Do we assume that we have some plaintext as the in reddit? $\endgroup$
    – kelalaka
    Sep 12, 2018 at 8:08
  • $\begingroup$ No, assume you only have ciphertext but know the lengths of the keys. $\endgroup$ Sep 12, 2018 at 15:54

2 Answers 2


Turns out the way you break it is by using the Kullback Test.


If you have significant known plain text, you should be able to crack this even if you never encrypt more than the product of the key lengths.

Let's take keys of length p and q If the attacker doesn't know p there aren't likely to be many options so we can iterate over them.

For known p we look for known plain text fragments positioned a multiple of p apart. Reduce the ciphertext by the plain text, the differences at distance p*i give us the length q key. Which we remove and then we trivially find also the length p key.

  • $\begingroup$ Would using more keys prevent this solution or just complicate it? $\endgroup$ Sep 14, 2018 at 18:58
  • 1
    $\begingroup$ Off the top of my head I can't think how to do this with many keys and when keeping a good distance from the product bound. If you can guess the product N and have known text i*N/p appart, same attack works. I suspect you can do better. $\endgroup$
    – Meir Maor
    Sep 15, 2018 at 4:08

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.