Vigenére Cipher

Vigenère cipher

It is a typical example of polyalphabetic encryption whose invention was wrongly attributed to Blaise de Vigenère, and dating back to the 16th century. The key consists of a sequence of symbols of the alphabet K = {k0, k1, …, kd-1}, of length d, and which uses the following linear congruent transformation of encryption:

Ek (mi) = mi + k (i mod d) (mod n)

being my the ith symbol of the clear text and n the cardinal (length) of the input alphabet. As a key you can use any word of a length for example between 6 and 8 characters, which does not have repeated letters.

To better see this, suppose that with our Spanish alphabet of 27 symbols, we want to encrypt the plain text “PLAN”, and that for encryption we use the word “SOL” as the key. The first letter of the message, the P will be encrypted with the first letter of the key, S, which indicates that we have to do the monoalphabet substitution E (“P”) = E (16) = (16 + 19) mod 27 = 8 = “I”, since if A occupies position 0, S occupies position 19 in our alphabet. The letter L of the message will be encrypted using the letter O of the key, and the letter A of the message will be encrypted using the letter L of the key. For the last letter of the message (N) we will use the first letter of the key (S) again.

Therefore we have as a result:
Message P L A N
Key S O L S
Encryption I Z L F

To facilitate operations with this cryptosystem, the so-called Vigenère box is arranged, which is formed by a 27×27 square matrix in the case of a 27-letter alphabet such as Spanish. The first row of the matrix is ​​formed by the alphabet starting with the letter A and ending with the letter Z, the second by the alphabet that begins with the B and ends in A, and so on until the last row, the 27th, which begins by the letters ZAB … and ends with the letter Y.

 

Vigenère cipher cryptanalysis

To encrypt this type of encryption, it is necessary to perform independent statistical analysis by grouping the cryptogram symbols into different groups according to the ki used to code them; Each group will be encoded with the same encryption alphabet.

To estimate the length d of the key, (that is, the number of different alphabets used in the encryption) we will look for the periodicity of the common patterns that may appear in the encrypted text. Obviously, for cryptanalysis, we will need at least d times more amount of encrypted text than with monoalphabetic methods