You are on page 1of 16

This to certify that the work content in the project report entitled

“HILL CIPHER: SOME APPROACHES TO MAKE IT MORE


SECURE” Submitted by Soumitra Paul (Roll-MC/PG/S-IV/18 No-
5229) of MATHEMATICS DEPARTMENT(PG) of MIDNAPORE
COLLEGE (AUTONOMOUS) towards the requirement of the course
M.Sc paper no MTMPG-404 has been carried out under my supervision
and that is has not been submitted for award for any degree elsewhere.

……………………………. …………………………………..
Signature of Co-ordinator (PG) Signature of Project Supervisor
(Dr. Himadri Shekhar Mandal) (Dr. Manimohan Mandal)
(Assistant Professor) (Associate Professor)

Page 1
I take this opportunity to express my deep sense of gratitude to all
those who helped me to complete this project. Although it is not easy to
express gratitude in this small paper but I try my best.
With immense pleasure, I would like to present this work as a
project assignment report on “Hill Cipher; Some Approaches To Make It
More Secure” under the guidance of Dr. Manimohan Mandal, I
express my heartfelt gratitude to my guide. He helped me a lot in my
project works, also encouraged and supported to make the work proceed
successfully on a forward case.
I am deeming gratified to express my gratitude to Dr. Himadri
Shekhar Mandal, Dr. Sujit Kumar De, Dr. Prasun Kumar Nayak,
Dr. Sankar Prasad Mandal, Sri Bijan Kumar Das for their consistent
and valuable support.
I also offer my thanks to all my batch mates for their unconditional
help and inspiration.

June, 2018 ……………………………..

Place : Midnapore Soumitra Paul

Page 2
1. Abstract
2. Introduction
3. Polyalphabetic Substitution Cipher
3.1. Hill Cipher
3.2. Modular Arithmetic
3.3. Key Space of Hill Cipher
4. Some Secured Modification of Hill Cipher
4.1 Key Space Extension
4.2. Generation of Involutary Key Matrix
4.3. Introduce a secure Variant, V
5. Still It Is Vulnerable
5.1. Known-Plaintext Attack
6. Conclusion
References

Page 3
Cryptography is the art of writing or solving codes, that is,
the practice and study for secure communication in the presence
of the third parties called adversaries. The Hill Cipher algorithm
is one of the polyalphabetic symmetric key algorithm that has
several advantages in data encryption algorithm. The Hill cipher
is a block cipher that distinguishes the letter frequencies of the
plaintext. Its simplicity because of using matrix multiplication
and inversion for encryption and decryption, and its high speed.
Several researcher tried to improve the security of Hill cipher. In
this work, some secure cryptosystem is introduced that
overcome most of security drawbacks of the Hill cipher.

Page 4
The Hill cipher was invented by Lester. S. Hill in 1929. It is a
famous polyalphabetic classical symmetric cipher based on matrix
transformation.
In the advance age of network technology, information security is
an increasingly important problem. All the operating systems like
Windows, Android, iOS, Blackberry are continuously working to
make there system more secure. Security of ATM card, computer
passwords, sending private Emails, everywhere Cryptography plays a
central role.
In modern times, cryptography is considered to be a branch of both
mathematics and computer science, and is affiliated with information
theory, computer security, and engineering.
Substitution cipher is one of the basic components of classical
ciphers. A substitution is a method of encryption by which units of
plaintext are substituted with ciphertext according to a regular system.
In this work we first discussed the original Hill cipher and its key
space; then proposed some advance modifications. Next we presented
the way of Image Encryption by Hill cipher; next vulnerability is
discussed. Finally, we described the concluding remarks.

Page 5
 Some Basic Terminology:
i. Plaintext – original message
ii. Ciphertext – coded message
iii. Cipher – algorithm for transforming plaintext to ciphertext
iv. Key – info used in cipher known only to sender & receiver
v. Encryption – converting plaintext to ciphertext
vi. Decryption – recovering plaintext from ciphertext
vii. Cryptography – study of encryption & decryption method
viii. Cryptanalysis – deciphering ciphertext without knowing key
ix. Cryptology – both cryptography & cryptanalysis

Page 6
In Polyalphabetic Substitution, each occurrence of a character may have
a different substitute. The relationship between a character in the
plaintext to a character in ciphertext is one-to-many. It has the advantage
of hiding the letter frequency of the underlying language. Hacker cannot
use single-letter frequency statistic to break the ciphertext.
Example: assume that Alice and Bob decide privately their key,
K=(1,3,2,0) then Alice send Bob a message through public channel as
“attack is today”
a b c d e f g h i j
00 01 02 03 04 05 06 07 08 09

k l m n o p q r s t
10 11 12 13 14 15 16 17 18 19

u v w x y Z
20 21 22 23 24 25
Table:1
Then by encryption,
Plaintext A T T A C K I S T O D A Y
P’s 00 19 19 00 02 10 08 18 19 14 03 00 24
Values
Key 1 3 2 0 1 3 2 0 1 3 2 0 1
stream
C’s 01 22 21 00 03 13 10 18 20 17 5 0 25
Values
Ciphertext B W V A D N K S U R F A z
Table:2

Page 7
(all operations done in mod 26)
Here, Plaintext : attackistoday;
Ciphertext: BWVADNKSURFAZ

3.1. Hill Cipher:

Hill’s Cipher Machine

It is developed by mathematician Lester Hill. The core of Hill cipher is matrix


multiplications. For encryption, algorithm takes m successive plaintext letters
instead of that successive m ciphers letters. In Hill cipher each character is
assigned a numerical value as ‘a=0, b=2,... ,z=25 (like Table;1). The substitution of
ciphertext letters in the place of plaintext letters leads to m linear equations.

For m=3, the system can be described as follows:

=( ) mod 26

Page 8
mod 26
mod 26 …………(1)

This case can be expressed in terms of column vectors and matrices:

( ) ( )( ) ..……….(2)

or simply we can write as C = KP , where C and P are column vectors of


length 3, representing the plaintext and ciphertext respectively, and K is 3×3
martix, which is the encryption key. All operation are done on mod 26 here.
Decryption requires the inverse of the matrix K. The inverse matrix
, where I is the Identity matrix. But the inverse of the matrix
does not always exist, and when it does it satisfy the preceding equation. In general
we can write as follows:
For encryption: ……………(3)

For decryption: ……………(4)


If the block length is m, there are different m letters blocks possible.

Example: Let ( ) then ( ) (mod 26)

Plaintext (P): HELLO WORLD


dividing the plaintext in 3×1 matrices and assigning numbers in mod 26 we

get ( ) ( ) ( ) ( ) ( ) ( ); ( ) ( );

Note that, we filled out the last matrix with uncommonly used letters. One can fill
it by repeating the last letter.

Now, ( )( ) ( ) ( )

Page 9
( )( ) ( ) ( )

( )( ) ( ) ( )

( )( ) ( ) ( )

Then the encrypted message becomes

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )

Ciphertext: TJNVQLAIVDIG;
Decryption:

( )( ) ( ) ( )

Where ( ) ( )

Proceeding in this way we can recover the plaintext ‘HELLOWORLDXX’


again. This hill cipher is known as ‘Hill-3 Ciphers’ as key matrix is of 3×3 order.

3.2. Modular Arithmetic:


Let m be a fixed positive integer. Two integer a & b are said to be congruent
modulo m if (a-b) is divisible by m, denoted by .
Example:
Modular Inverse: In modular arithmetic, a number ‘a’ has modular inverse
for a number m such that
In order for inverse exist, ‘a’ and ‘m’ must not have any common factors.

Page
10
To create matrices for Hill ciphers, we need to know which numbers have
invers in mod 26.

1 3 5 7 9 11 15 17 19 21 23 25
1 9 21 15 3 19 7 23 11 5 17 25
Table:3

3.3. Key Space of Hill Ciphers:


Hill cipher uses n×n matrices. Then upper bound of key space is ,
because not all the matrices is invertible in mod 26.

As for example, A= ( ) is not invertible.

Since, [ ]
That is, a matrix is invertible modulo 26 if and only if it is invertible in both mod 2
and mod 13.
The number of invertible n×n matrices modulo 2 is equal to the order of the
General Linear Group It is ( )( ) .

Similarly, order of the group is ( )( )

Thus, number of invertible matrices mod26 is product of these two numbers:

( )( ) ( )( ) .

Page
11
Being a symmetric key cipher, Hill cipher is used mainly as private key at
internetwork security. But it is still a weak algorithm for its small key space.
Also, finding invertible matrix is time-consuming. Besides, we can break its
security by solving some linear equations.
So, here we are going to modify these draw backs.

4.1. Extension Key Space:


The risk of the matrix taken from key space having common factors of the
det(A) with the modulus can be eliminated by making the modulus prime.
Consequently, a useful variant of the Hill cipher add three extra symbols (such as
‘Space’, ‘Full Stop’ and ‘Question Mark’) with these 26 alphabets to increase the
modulus to 29 . Then key space become equivalent to General linear Group
.

4.2.Generation of Involutary Key Matrix:


The proposed algorithm uses an involutary key matrix for encryption
technique. A is called a involutary matrix if . The analysis presented here
for generation of involutary key matrix is valid for matrix of +ve integers that are
the residues of modulo arithmetic of a number. This algorithm can generate
involutary matrices of order n×n where n is even.

Let ( ) be an n×n involutary matrix partitioned to

( ), where n is even and are matrices of order


each.

So,
If is one the factors of then is the other.
Solving the 2nd matrix equation results .
Then form the matrix.

Page
12
Algorithm:

I. Select any arbitrary matrix


II. Obtain .
III. Take where k is a scalar constant.
IV. Then .
V. Form the matrix completely.
Example: (for Modulo 13)

Let ( ) then ( ).

If

then, ( ), and

( ).

So, ( )

Thus we can reduce the difficulty of calculating the inverse of the key matrix.

4.3.Introduce A Secure Variant, V:


In Hill cipher, the ciphertext obtained from the plaintext by means of a linear
transformation. The plaintext column vector P is encrypted as C =K.P. (mod m) in
which C is the ciphertext column vector and K is an n×n key matrix where ϵ
, the ring of integers modulo m(>1). Also the ciphertext is decrypted as
.

Page
13
To make the transformation nonlinear we introduce a column vector V with
the following form : , where the variant is of the form
. This variant will be privately discussed.
For the time of decryption we use the formula .

After so many development and work Hill Cipher till has a flaw, well known
as ‘Known-Plaintext Attack’ which sometimes break the security of Hill cipher,
although this attack is laborious.

5.1 Known-Plaintext Attack : In Known-Plaintext Attack Eve


has access to some plaintext / ciphertext pair in addition to the intercepted
ciphertext that she wants to break.

The plaintext/ ciphertext pairs have been collected earlier. For example,
Alice has sent a secret message to Bob, but she has later made the contents of the
message public. Then Eve compare this plaintext/ ciphertext pair with the
previously collected pairs. He applies ‘ Brute-Force Attack’ and compares the

Page
14
letter frequencies successively and keeps going until he gets any meaningful
sentence. For example, if ciphertext is ‘THHMTH’, then by frequency count he
considers ‘e’ in place ‘H’.

Frequency Occurrence of English Alphabets


The most famous theorem of information theory was said by Shannon in
1949, roughly speaking, that the only way to obtain perfect secrecy is to use the key
of infinite order (k= ).

The advantage of asymmetric key (public-key) cryptography does not


eliminate the need of symmetric key (secret-key) cryptography. Because
asymmetric key cryptography uses mathematical functions for encryption and
decryption, is much slower than symmetric key cryptography. For encryption of
large messages, symmetric key cryptography is still needed. This work point out
the flaw of Hill Cipher and some modifications. AdvHill is a fast encryption
technique which can provide satisfactory results against the normal Hill cipher

Page
15
technique. Here, symmetric key cryptosystem is actually secure variant. Each
block of data is encrypted using different random number. Since the modulus
becomes a prime number, the key space greatly increased.

1. Mihir Bellare, “Notes on Cryptography”, MIT Computer Science and Artifical


Intelligence Laboratory,July 2008
2. B. A. Forouzan & D. Mukhopadhay, “Cryptography and Network Security”,
McGraw Hill Education(India) Private Limited, reprint 2015
3. Neal Koblitz, “Algebraic Aspects of Cryptography”, Springer, Vol.3, Edition
1999
4. S. K. Panigrahy, B. Acharya, S. K. Patra & G. Panda, “Advanced Hill Cipher
Algorithm”, International Journal of Recent Trends in Engineering, Vol. 1,
No. 1, May 2009
5. V. U. K. Sastry, A. Varanasi, S. U. Kumar, ”Hill Cipher Handling the Entire
Plaintext”, International Journal of Advanced Research in Computer Science,
Vol 1, No. 4, Nov-Dec 2010

Page
16

You might also like