[Math] Double Vigenere Cipher

cryptography

I have given a ciphertext: vpitqjcahpzkcvdtmttmtnmjuigf
and two Keys: k1 = SECRET, k2 = KEY.
Decryption is done by applying the keys one by one, but you can also encrypt k1 with k2, which yields k3 = CIABIR. Then it is also possible to use k3 for decryption.
In both cases i get the same result for the plaintext: thisisashortandsecretmessage.
How can i describe this mathematically and therefore show that a single encryption with k3 is equivalent to double encryption with the keys k1 and k2?

Best Answer

That is easy if you know write it down - assuming the keys have the same size.

$$C_i = P_i + K_{i \pmod{keyLenght}} \pmod{26}$$

For simplicity consider only the first char.

$$C_1 = P_1 + K_1 \pmod{26}$$

Now consider other two keys $K'$ and $K''$ such that $K = K' + K'' \pmod{26}$

Encrypt $P_1$ with $K'$ than $K''$ $C_1$

$$C_1'= P_1 + K_1' \pmod{26}$$ $$C_1'' = C_1' + K_1'' \pmod{26}$$

Substitute

$$C_1'' = P_1 + K_1' + K_1'' \pmod{26}$$ then

$$C_1'' = P_1 + K_1 \pmod{26}$$

So, you get the double encryption with single encryption.

Therefore, the sum of the two keys is actually another key that is equal to the double encryption.

You can similarly find a key for triple encryption, quad, etc.

Related Question