# Hill Cipher

TERM-PAPER

3/31/2013

LPU

vidit

Name: Vidit kumar Singh.

Reg no: 11009010

Roll no: B38.

Cap : 323.

Sub : Information Security and privacy.

INDEX

Introduction

Workings

Decryption

Matrix Inverse

Hill ciphers that encipher larger blocks

Ciphertext Attack

Known plaintext attack

Security

Key size

Diffusion and Confusion

Conclusion

References

Hill Cipher

Introduction

Invented by Lester S. Hill in 1929, the Hill cipher is a polygraphic substitution cipher based on linear algebra. Hill used matrices and matrix multiplication to mix up the plaintext. To counter charges that his system was too complicated for day to day use, Hill constructed a cipher machine for his system using a series of geared wheels and chains. However, the machine never really sold. [1] Hill's major contribution was the use of mathematics to design and analyse cryptosystems. It is important to note that the analysis of this algorithm requires a branch of mathematics known as number theory .Many elementary number theory text books deal with the theory behind the Hill cipher, with several talking about the cipher in detail (e.g. Elementary Number Theory and its applications, Rosen, 2000). It is advisable to get access to a book such as this, and to try to learn a bit if you want to understand this algorithm in depth. [2] Each letter is represented by a number modulo 26. (Often the simple scheme A = 0, B = 1, ..., Z = 25 is used, but this is not an essential feature of the cipher.) To encrypt a message, each block of n letters (considered as an n-component vector) is multiplied by an invertible n × n matrix, again modulus 26. To decrypt the message, each block is multiplied by the inverse of the matrix used for encryption. The matrix used for encryption is the cipher key, and it should be chosen randomly from the set of invertible n × n matrices (modulo 26). The cipher can, of course, be adapted to an alphabet with any number of letters; all arithmetic just needs to be done modulo the number of letters instead of modulo 26. [1]

Workings

The situation with regard to the Hill cipher is much the same as that with regard to the Vigenère cipher. What is usually referred to as the Hill cipher is only one of the methods that Hill discusses, and even then it is a weakened version. We will comment more about this later, but first we will consider what is usually called the Hill cipher. The Hill cipher uses matrices to transform blocks of plaintext letters into blocks of ciphertext. Here is an example that encrypts digraphs. [9] Consider the following message:

Herbert Yardley wrote The American Black Chamber.

Break the message into digraphs:

he rb er ty ar dl ey wr ot et he am er ic an bl ac kc ha mb er (If the message did not consist of an even number of letters, we would place a null at the end.) Now convert each pair of letters to its number-pair equivalent. We will use our usual a = 01, …, z = 26. 8 5 18 2 5 18 20 25 1 18 4 12 5 25 23 18 15 20 5 20 8 5 1 13 5 18 9 3 1 14 2 12 1 3 11 3 8 1 13 2 5 18 Now we encrypt each pair using the key which is the matrix

Make the first pair of numbers into a column vector (h (8) e (5)), and multiply that matrix by the key.

Of course, we need our result to be mod 26

The cipher text is G (7) V (22).

For the next pair r (18) b (2),

and 16 corresponds to P and 10 corresponds to J. Etc.

Do this for every pair and obtain

GVPJKGAJYMRHHMMSCCYEGVPEKGVCWQLXXOBMEZAKKG

Encryption is like using a multiplicative cipher except that multiplying by a matrix allows us to encipher more than one letter at a time. [2]

Decryption

Of course, we need a procedure for decrypting this. However, just like for the multiplicative ciphers, we cannot use all matrices as keys because we cannot undo the multiplication for all matrices. To go from plaintext to ciphertext in the first example above we...

Please join StudyMode to read the full document