1

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?

2 Answers2

1

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.

kelalaka
  • 1,637
  • 1
    And note that using KEY is the same as using KEYKEY. That and SECRET both have length $6$ so that this applies. The new total key is the sum mod $26$ of KEYKEY and SECRET, e.g. K = 10, S=18, so the sum is 28 (so 2), which means C etc. – Henno Brandsma Oct 13 '19 at 20:37
  • @HennoBrandsma similarly the LCM of the two keys' lenght has the same results. – kelalaka Oct 13 '19 at 21:13
0

This is because the length of $k1$ is a multiple of the length of $k2$.

A double Vigenère cipher is typically stronger than just using a single key, but it is only of maximal strength of the lengths of the keys are relatively prime. In that case, you are essentially creating a single Vigenère cipher whose key length is the product of the two individual key lengths. To give an example, if your second key was "MESSAGE", then your k3 would need to be 42 characters long instead of 6.