The risk of the determinant having common factors with the modulus can be eliminated by making the modulus prime. Playfair Key Matrix5X5 matrix of letters based on a keywordFill in. Since this has no common factors with 26, this matrix can be used for the Hill cipher. Cryptanalysis of Caesar CipherOnly have 26 possible ciphersA maps to A,B. Fortunately, matrices which satisfy the conditions to be used in the Hill cipher are fairly common. The KEY is generally given in the problem statement. C is ciphertext, K is the key, P is the plain text vector. The Beaufort Cipher is reciprocal (the encryption and decryption algorithms are the same). The plaintext letter is subtracted from the key letter instead of adding them. It is similar to the Vigenre cipher, but uses a different 'tabula recta'. If the determinant is 0, or has common factors with the modular base, then the matrix cannot be used in the Hill cipher, and another matrix must be chosen (otherwise it will not be possible to decrypt). The working is shown below: Input : 1.Plain text that has to be converted into ciphertext. The Beaufort Cipher is named after Sir Francis Beaufort. Thus, if we work modulo 26 as above, the determinant must be nonzero, and must not be divisible by 2 or 13. The matrix will have an inverse if and only if its determinant is not zero, and does not have any common factors with the modular base. The second step is to convert the keyword matrix. Next, convert the keyword matrix into a key matrix by replacing the letters with corresponding numeric values. The first step is to convert the given keyword to a 3x3 matrix form. Not all matrices have an inverse (see invertible matrix). To encrypt a plaintext, follow these steps: Turn the keyword to matrix. We have not yet discussed one complication that exists in picking the encrypting matrix.
Which gets us back to 'ACT', just as we hoped. Taking the previous example ciphertext of 'POH', we get: (There are standard methods to calculate the inverse matrix see matrix inversion for details.) We find that, modulo 26, the inverse of the matrix used in the previous example is:
In order to decrypt, we turn the ciphertext back into a vector, then simply multiply by the inverse matrix of the key matrix (IFKVIVVMI in letters).