Hill Cipher Modification with Eigenvalues
Hill Cipher Modification with Eigenvalues
net/publication/274601877
CITATIONS READS
39 1,490
1 author:
Ahmed Mahmoud
Al-Azhar University – Gaza
25 PUBLICATIONS 350 CITATIONS
SEE PROFILE
All content following this page was uploaded by Ahmed Mahmoud on 01 June 2016.
[Link]
Abstract: The Hill cipher is resistant to brute-force and statistical attacks, but it can be broken with a known plaintext-ciphertext attack
(KPCA). In this paper, we propose a modification of the Hill cipher, HCM-PRE, which is still resistant to brute-force and statistical
attacks, and is resistant also to KPCA due to dynamic encryption key matrix generating. With the modification, the new HCM-PRE
can be applied widely in the systems which need high security (e.g., image encryption). Experimental results show that the proposed
modification is significantly more effective in the encryption quality of images than original Hill cipher and its known modifications
(HCM-PT, HCM-H, HCM-HMAC, and HCM-EE) in the case of images with large single colour areas, and slightly more effective
otherwise. HCM-PRE is about two times faster than HCM-EE and HCM-HMAC and four times faster than HCM-H in the frame of our
experiments.
Keywords: Keywords: Hill cipher, matrix, eigenvalue, diagonal matrix, exponentiation, pseudo-random number, dynamic key, image
encryption
between HCM-PT and HCM-NPT. In [14], we introduce (K −1 )t = (Kt )−1 [4] from K −1 , and then reveals the
a modification of the HC, HCM-EE, based on the use of plaintext by (2), using (K −1 )t instead of K −1 . The
eigenvalues for matrix exponentiation to a number of dynamic keys used in HCM-PT is
pseudo-random power for a new key matrix generating
for each plaintext block. In this paper we propose a new NDK(HCM − PT ) = m! (4)
modification of HC, HCM-PRE, based on the use of
pseudo-random eigenvalues to construct a key matrix [15] HCM-NPT [7] uses the same initialization and the
and modify it for each new plaintext. same encryption/decryption technique as HCM-PT does.
The rest of the paper is organized as follows. Section But HCM-NPT assumes that the sender, A, and the
2 briefly introduces the Hill cipher, HCM-PT, HCM-NPT, receiver, B, share a secret seed value, SEED, which is
HCM-H, HCM-HMAC, and HCM-EE. Section 3 is used to generate a pseudo-random sequence of
devoted to the proposed modification HCM-PRE. permutations. In order to encrypt a plaintext, the sender,
Experimental results of image encryption quality and the A, selects a number r, and calculates
performance of the proposed modification versus the
known ones are presented in Section 4. Security and tr = PRPermutationG(SEED, r), (5)
statistical analysis of the proposed HCM-PRE are
discussed in Section 5. Finally, the conclusion is getting the r-th output permutation from the
presented in section 6. In the Appendix, description of pseudo-random permutation generator PRPermutationG
used encryption quality measures is given. (r can be a block number in the sequence of transmitted
blocks, or its function). Sender A then gets a ciphertext C
as in HCM-PT, and sends to receiver B both C and r. In
order to decrypt, B calculates tr according to (5), and then
2 Overview of the Hill Cipher and its gets the plaintext as in HCM-PT. The number of dynamic
Mmodifications keys used in HCM-NPT, NDK(HCM-NPT), is the same
as NDK(HCM-PT) (4).
All matrices considered throughout the paper are m x m Proposed in [6], another HC modification, HCM-H,
sized with entries over ZN = {0, 1, ...N − 1} , hence all the works as follows. The sender, A, and the receiver, B, share
operations in encryption/decryption algorithms are an invertible matrix K. To encrypt the plaintext P, A,
assumed mod N, where m (block size) and N (alphabet selects a random integer a, where 0 < a < N, and applies
cardinality) are selected positive integers (e.g., N=256 for a one way hash function to compute the parameter
gray scale images). Also, we assume that two parties, A b = f (a k k11 k k12 ... k kmm ), where k11 , k12 ..., kmm are the
and B, want to communicate securely, and A is a sender, elements of K; b is used to select the ki j from K, where i
and B is a receiver. and j can be calculated according to (6)
First, we introduce HC, HCM-PT, HCM-NPT,
HCM-H, HCM-HMAC and then we describe HCM-EE.
When HC is used, A and B share an invertible key b−1 b−1
i= .(modm) + 1, j = b − .m. (6)
matrix K. Sender A encrypts a plaintext vector, P: m m
c 2014 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 8, No. 2, 505-516 (2014) / [Link]/[Link] 507
c 2014 NSP
Natural Sciences Publishing Cor.
508 A. Mahmoud, A. Chefranov: Hill Cipher Modification based on Pseudo-Random Eigenvalues
powers in HCM-EE. If the sender, A, and the receiver, B, L = N × M . Then, the so obtained three vectors represent
want to communicate using HCM-PRE, they share a the plaintext P(3 × L) which will be encrypted using the
secret value, SEED, that is used to generate block size m=16.
pseudo-randomly a sequence of eigenvalue sets, We examine the encryption quality for three different
E = (Ei ), 1 ≤ i ≤ n: images containing very large single colour areas:
[Link] (Fig. 1), [Link] (Fig. 2), and
E = PRSetGSEED (n, m), (25) [Link] (Fig. 3). Also we examined the encryption
where Ei = {ei j } ⊏ ZN − {0} is is a set of eigenvalues of quality for an image that does not contain many high
the matrix to be constructed, ei j is relatively prime to N, frequency components: [Link] (Fig. 4). The [Link]
1 ≤ j ≤ m, 1 ≤ i ≤ n, for positive integers n and m , n is (Fig. 5) is used as an example of an image containing
the number of blocks; PRSetGSEED (n, m) is a many high frequency components. Each image is
pseudo-random set sequence generator (using e.g., RC4 encrypted using HCM-PT, HCM-H, HCM-HMAC,
initialized by SEED) returning n sets, each of which HCM-EE, and HCM-PRE.
contains m numbers. The quality of encryption of these images is studied
Sender A then constructs an invertible matrix Q as in by visual inspection (Figs. 1-5) and quantitavely (Table 1,
HCM-EE. The key matrix is calculated by (17) but, used irregular deviation based quality measure ID [8, 19,
instead of D, diagonal matrix Di is used, diagonal 20] is explained in the Appendix).
elements of which are all the eigenvalues from Ei , Based on visual inspection, it is obvious that the HCM-
1 ≤ i ≤ n. HCM-PRE uses a different set of diagonal PRE and HCM-EE are better than the HCM-PT, HCM-H,
elements for every plaintext. It may be easily shown that and HCM-HMAC in hiding all the features of the image
KMi is invertible modulo N since Q and Di have (by containing large single colour areas (Figs. 1-3).
construction) determinants relatively prime to N. Based on the numerical evaluation of encryption
Finally, the plaintext Pi is enciphered by (22). quality measure ID (Table 1), we note that the proposed
scheme HCM-PRE versus HCM-EE give better
To decrypt a ciphertext, receiver B computes E encryption quality. Table 1 shows also that the proposed
according to (25), and finds scheme HCM-PRE is more effective in encryption quality
than HCM-PT, HCM-H, and HCM-HMAC. On the other
(KMi )−1 = (Q × Di × Q−1 )−1 = Q × D−1 −1
i × Q . (26) hand, HCM-PT, HCM-H, HCM-HMAC, HCM-EE, and
HCM-PRE are all good in encrypting images containing
Note that to get D−1
i , we calculate the inverse of m many high frequency components; all the algorithms give
numbers only, and that Q and Q−1 are constructed only nearly the same results but the HCM-PRE and HCM-EE
once. Receiver B then retrieves the plaintext by (23). To are the most effective ones (Table 1, rows 4-5).
generate an invertible key matrix Di , the eigenvalues must We examined the encryption time for the [Link]
be in the multiplicative group of ZN , the number of image having pixels and 45KB size. The encryption time
possible eigenvalues in the multiplicative group of ZN is measured when applying HCM-PT, HCM-H,
ϕ (N). Hence the number of dynamic keys of HCM-PRE HCM-HMAC, HCM-EE, and HCM-PRE is shown in
is Table 2. In our implementation, HCM-EE and HCM-PRE
were used with RC4 [5] for the pseudo-random
m Period(RC4)
NDK(HCM − PRE) = min ϕ (N) ,
permutation generator (5), pseudo-random number
m
(27) generator (18) for HCM-EE, and pseudo-random set
where Period(RC4) is overwhelmingly likely to be greater generator (25) for HCM-PRE. We implemented HCM-H
than 10100 [18]. with SHA-1 [13] since the latter has been used in [6], and
the built-in HMAC from C # with HCM-HMAC-SHA-1.
Table 2 shows that HCM-PRE has the best execution
time; it is roughly two times faster than HCM-EE and
4 Image Encryption Quality and HCM-HMAC, and four times faster than HCM-H.
Performance of the HCM-PRE Versus HCM-EE roughly is twice better than HCM-H and it has
Known Ones nearly the same execution time as of HCM-HMAC but
HCM-EE has better encryption quality (Figs. 1-5, and
We developed programs for simulating the encryption Table 1). Table 2 shows that HCM-PT is faster than
schemes in C# on an Intel(R) Core(TM) 2 Duo 1.8 GHz HCM-EE but equations (4) and (24) show that
processor with 2-GB RAM and Windows XP. NDK(HCM-EE) is greater than NDK(HCM-PT), hence
In our experiments, several RGB images are HCM-EE is more secure than HCM-PT. Equation (27)
encrypted. Firstly, the image, P, of size N × M is shows that NDK(HCM-PRE) is greater than
converted into its RGB components. Afterwards, each NDK(HCM-EE). Hence HCM-PRE is more secure and is
colour matrix (R, G, B) is converted into a vector of more effective in the encryption time than HCM-PT,
integers within {0, 1, ...,255}. Each vector has the length HCM-H, HCM-HMAC and HCM-EE.
c 2014 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 8, No. 2, 505-516 (2014) / [Link]/[Link] 509
Table 1: ID for encrypted images using HCM-PT, HCM-H, HCM-HMAC, HCM-EE and HCM-PRE, m=16.
c 2014 NSP
Natural Sciences Publishing Cor.
510 A. Mahmoud, A. Chefranov: Hill Cipher Modification based on Pseudo-Random Eigenvalues
c 2014 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 8, No. 2, 505-516 (2014) / [Link]/[Link] 511
c 2014 NSP
Natural Sciences Publishing Cor.
512 A. Mahmoud, A. Chefranov: Hill Cipher Modification based on Pseudo-Random Eigenvalues
Fig. 8: Correlation coefficients of two adjacent pixels in [Link] encrypted by: HCM-EE, HCM-PRE, HCM-PT, HCM-
H, and HCM-HMAC
Table 3: Correlation coefficients of two adjacent pixels in original and HCM-PT-encrypted images, HCM-H-encrypted
images, HCM-HMAC-encrypted images, HCM-EE-encrypted images and HCM-PRE-encrypted images.
Encrypted Image
Image Direction Plain Image
HCM-PT HCM-H HCM-HMAC HCM-EE HCM-PRE
Horizontal 0.9413 0.0849 -0.0337 -0.0517 -0.0004 0.0028
[Link] Vertical 0.9031 0.1484 0.0951 -0.0134 0.0396 0.0013
Diagonal 0.9801 0.5743 -0.0602 0.0743 0.0365 0.0051
Horizontal 0.9349 -0.0074 0.0498 0.0168 0.0282 -0.0435
[Link] Vertical 0.8538 0.0037 -0.0473 0.0026 0.0272 -0.0130
Diagonal 0.8852 -0.0774 -0.0146 0.0071 -0.0095 0.0084
c 2014 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 8, No. 2, 505-516 (2014) / [Link]/[Link] 513
Fig. 9: Correlation coefficients of two adjacent pixels in [Link] encrypted by: HCM-EE, HCM-PRE, HCM-PT, HCM-
H, and HCM-HMAC
c 2014 NSP
Natural Sciences Publishing Cor.
514 A. Mahmoud, A. Chefranov: Hill Cipher Modification based on Pseudo-Random Eigenvalues
∑ ∑
u u
(xi − E(x)) t (yi − E(y))2
2
u u
t
i=1 i=1
c 2014 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 8, No. 2, 505-516 (2014) / [Link]/[Link] 515
c 2014 NSP
Natural Sciences Publishing Cor.
516 A. Mahmoud, A. Chefranov: Hill Cipher Modification based on Pseudo-Random Eigenvalues
Ahmed Mahmoud
received a BSc. in Computer
Science from Al-Zaytoonah
University, Amman,
Jordan in 1997, an MSc.
in Applied Mathematics and
Computer Science and PhD
in Computer Engineering
from Eastern Mediterranean
University, North Cyprus, in
2001 and 2012, respectively. From 2001 to 2006 he was a
Lecturer in the Computer Science Department at
Al-Azhar University, Gaza Strip, Palestine. From
September 2006 to September 2011 he was with
the Computer Engineering Department at Eastern
Mediterranean University, Famagusta, North Cyprus.
Since January 2012 he has been an Assistant professor in
the Information Technology Department at Al-Azhar
University, Gaza Strip, Palestine. His research interests
are in the areas of information security, discrete geometry,
parallel programming, and distributed systems
Alexander Chefranov
received a diploma of
Engineer in Applied
Mathematics, PhD,
and DSc from Taganrog
State Radio-Engineering
University, Russia, in 1978,
1984, and 1998, respectively.
Since 1999 he has been
a Professor of Software
Engineering Department of the Institute of Technology,
South Federal University, Taganrog, Russia, and,
since 2002, he has been an Associate Professor of
the Department of Computer Engineering, Eastern
Mediterranean University, Famagusta, North Cyprus. His
research interests are in the areas of information
security, parallel processing, real-time systems, database
management systems, and scientific computing.
c 2014 NSP
Natural Sciences Publishing Cor.