# Testing Kasiski Test and Mutual Index of Coincidence on Vigenere Encryption on Vigenere Encryption?

I was learning about Vigenere Ciphers and its various cryptanalytic attacks. One of them was, Kasiski test and Mutual Index of Coincidence. So, I was wondering can Kasiski test and Mutual Index of Coincidence crack the Vigenere encryption of Vigenere encryption itself (keys may be different or same) i.e. plaintext encrypted using Vigenere cipher and the output of this again encrypted using Vigenere cipher? Will using such scheme create appropriate confusion for the attacker or will it act as a vulnerability?

Vigenere algotrith suppose that Alice would send a message (M) to Bob. The message is written in some language and has a length ML (symbols that compose the message have a known frequency and belong to an alphabet A with a given size AL). To encript a message Alice use a key (K) that in Vigenere alogrithm is a seqeuence of symbols called Worm shortest (by definition) than the message, both Alice and Bob knwon K that does not need to be exchanged. The encripotion is applied by adding the value of each message symbol by the value of the corresponding worm sybol (worm could be completly random) modulo AL.

Eg :

M = "hello world today is fine"
ML = 25
K = "abc"
KL = 3

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
K as values :
61 62 63


As you can see because the worm is short than message (by definition) we need to repeat it, again and again to reach ML

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
K as values (repeated) :
61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61


What we obtain indeed is a sequence of three Caesar encription (in the general case the number of Caesar encription is KL = Key Length):

This is the first Caesar

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
|        |        |        |        |        |        |        |        |
K as values (repeated) :
61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61

Caesar SubMessage : 68 6C 77 6C 74 61 69 66 65
Caesar Key : 61


This is the second Caesar

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
|        |        |        |        |        |        |        |
K as values (repeated) :
61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61

Caesar SubMessage : 65 6F 6F 64 6F 79 73 69
Caesar Key : 62


This is the third Caesar

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
|        |        |        |        |        |        |        |
K as values (repeated) :
61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61 62 63 61

Caesar SubMessage : 6C 20 72 20 64 20 20 20 6E
Caesar Key : 63


Symbol frequencies on the main message remain the same if we "regulary split" it on the submessage, so classical attack on Caesar (the ones based on frequency) is still applicable on the three Caesar Submessage.

As you can image if you double the Vigenere encription the complexity of the attack does not change ( EG : add K1 = "def").

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
K as values :
61 62 63

K1 as values :
64 65 66


This because Vigenere encription is composed by Caesar encription and Caesar encription is an associative operation so :

( 68 + 61 mod AL ) + 64 mod AL = ( 68 + ( 61 + 64 mod AL ) ) mod AL


so a double encription is equivalent to a change of the key in a single encription, but the key nature (random or not) does not fix any security problem of that alogrithm.

In the example above (about the double encription) the resulting key, obtained by combining K and K1 is called K2 (i have assumed that AL = 256 and A is the ASCII table) :

K2 = C5 C7 C9


So the double encription is equivalent to a single instance like the below

M as values :
68 65 6C 6C 6F 20 77 6F 72 6C 64 20 74 6F 64 61 79 20 69 73 20 66 69 6E 65
K2 as values (repeated) :
C5 C7 C9 C5 C7 C9 C5 C7 C9 C5 C7 C9 C5 C7 C9 C5 C7 C9 C5 C7 C9 C5 C7 C9 C5


That istance certainly is not stringer than the first ones.

• So you mean, that even if the Vigenere encryption is performed twice, the properties won't change thus making the tests easier and not affecting any complexity of the algorithm and thus two times encryption is of no significance? – kiner_shah Oct 3 '16 at 14:02
• The only change is that the encription is more expensive for Alice and Bob, but for Eve the criptanalysis is the same. As shown in the post dobule encription is equivalent with a single encription with different key. That give no security gain in practice. – Skary Oct 3 '16 at 16:14