Efficient Digital Encryption Algorithm Based On Matrix Scrambling Technique
Efficient Digital Encryption Algorithm Based On Matrix Scrambling Technique
4, October 2010
ABSTRACT
This paper puts forward a safe mechanism of data transmission to tackle the security problem of
information which is transmitted in Internet. We propose a new technique on matrix scrambling which is
based on random function, shifting and reversing techniques of circular queue. We give statistical
analysis, sequence random analysis, and sensitivity analysis to plaintext and key on the proposed scheme.
The experimental results show that the new scheme has a very fast encryption speed and the key space is
expanded and it can resist all kinds of cryptanalytic, statistical attacks, and especially, our new method
can be also used to solve the problem that is easily exposed to chosen plaintext attack. We give our
detailed report to this algorithm, and reveal the characteristic of this algorithm by utilizing an example.
KEYWORDS
Cipher text, Encryption, Decryption, Random Number Generator, Circular queue.
1. INTRODUCTION
With the rapid growth of Internet, global information tide expends the application of
information network technology. It also brings about great economic and social benefit along
with the extensive use of this technology. However, because Internet is an open system which
faces to public, it must confront many safe problems. The problems include network attack,
hacker intruding, interception and tampering of network information which lead huge threat to
Internet [3]. Information security becomes a hot problem which is concerned by our society.
Security of the information over the insecure mode of communication, Internet, has been an area
of research for years. There have been several techniques developed for encryption/decryption
of the information over the years.
This paper discusses a new technique of encrypting data which enables good diffusion and is
having a unique technique of decrypting it back to the plaintext and is easy to implement using
matrix scrambling technique. The encryption algorithm of magic cube projected by Yongwei et
al. which is implemented in three-dimensional space [5][11][4]. The algorithm is complicated
and difficult to understand. F. Y. LI Min. proposed queue transformation based digital image
encryption algorithm [6], which works efficiently with low time complexity compared to
Yongwei et al.. However, it still has some shortcomings. Firstly, the algorithm signifies some
certain regularity. According to F. Y. LI Min, algorithm, assume we randomly select one
element, (i, j), from the matrix, rows (columns) with row (column) ID smaller than i(j)
cyclically shifts leftward (upward) with increasing steps, and rows (columns) with row (column)
ID greater than i(j) cyclically shifts rightward (downward) with proceeding steps. This
regularity makes the encryption output represent some certain periodicity with the increasing of
steps, which make the algorithm vulnerable to attacks with ease of decryption. Secondly, one
operation to a n× n matrix will cause n(n − 2i − 1)/2 cyclic shifts. At least n operations is needed
for scrambling, which makes the time complexity of this algorithm be O(n3).
DOI : 10.5121/ijnsa.2010.2403 30
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
2. ENCRYPTION ALGORITHM
The plaintext chosen is arranged into a Bi-directional circular Queue data structure [10],In the
matrix A of order m × n. Input an integer parameter, w, as the count of operations, say, the time
of transformation we made to matrix. To some certain degree, this parameter represents the
intensity of the encryption. However, this does not necessarily mean that the greater w is, the
more intensive the encryption is. Random() function is used to generate random positive integer,
this integer value has to be converted into a binary equivalent [9]. Depending on the binary bit
from least significant bit to most significant bit, the choice to select rows or columns is made. In
case of row, two rows r1 and r2 are selected randomly from the matrix similarly two random
values of columns c1, c2 are chosen to determine the range of rows on which transformation has
to be performed. To perform transformation operations, a value is calculated from Random( )
mod3, circular left shift, circular right shift and reverse operations on the selected rows is
performed depending on the value which may be 0,1 or 2 In case of column, two columns c1
and c2 are selected randomly from the matrix, two random values of rows r1,r2 are chosen to
determine the range of columns on which transformation has to be performed.. Then to perform
transformation operations similar to rows, a value is calculated from Random( ) mod 3, based
on it circular upward shift, circular downward shift and reverse operations are performed similar
as rows.
The entire process is repeated w number of times; if w ≤ length (binary sequence) then the
process is performed only w number of times from LSB to MSB else the binary sequence is
repeated from LSB to MSB until the w operations. In this manner, the entire matrix elements
are transposed. For each operation performed, the operation should be recorded as a sub~key in
a file, which becomes the key file. The key file should be maintained secret. The decryption
process is done by reading the operations in the key file in reverse order and applying necessary
operations on the matrix, which contains cipher text as to get plain text.
Here we make introduction to our encryption algorithm, which is given in figure 1. The function
Random(n) generates random positive integers less than or equal to n and Random(m) generates
random positive integers less than or equal to m, where m, n ϵ N and Random( ) be the random
function which generates random positive integers. These random numbers could be
implemented by technology of chaotic sequence, wavelet transformation, elliptic curve and so
on [8][1][7][2].The entire process of encryption is summarized below:
1. The original plain text is stored in an m × n matrix A, where m ϵ N, n ϵ N.
2. Input an integer parameter w, which represents no. of rounds of operations to perform.
Depending on w, w transformations are applied on the matrix. To some extent, this
parameter represents the intensity of encryption. However, this does not necessarily mean,
the greater w is, the more intensive encryption is.
3. Let i = Random(), hence ‘i’ is a random positive number which decides which
transformation is applied either row transformation or column transformation. The value of
i provides some sort of strength to the encryption. After choosing i , binary value of i is
calculated and placed in a vector b, b = Binary Sequence(i). The good choice of i gives
better binary sequence to perform transformations on the matrix.
4. Let k = Digit(bt), where ‘t’ is bit position, k value is either 0 or 1, which provides a way of
deciding either to perform row or column transformation. If k = 0, then A = RowTrans(A)
is performed i.e. row transformation operations are applied on the matrix as given below
31
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
(i) We illustrate the process of row transformation operations i.e. A = RowTrans(A) in this
section, the algorithm is shown in figure 2,Two rows are selected randomly, r1 = Random
(m),r2 = Random(m) similarly two random values of columns c1,c2 are selected i.e.
c1=Random(n), c2=Random(n), to determine the range of rows on which transformation has to
be performed. The constraint here is r1 ≠ r2 and c1≠c2 Let x1 = min(c1,c2), x2 = max(c1,c2),
Here x1 and x2 becomes lowest index and highest index of the sub array selected in the rows r1
and r2 .
Let op = Random() mod 3, hence op takes three possible values 0 , 1 and 2. Thus three row
operations are performed on the matrix. If op = 0, then circular left shift operation is performed
on rows r1 and r2 on the sub portion of range x1 to x2. If op = 1, then circular right shift
operation is performed on rows r1 and r2 on the sub portion of range x1 to x2. If op = 2, then
perform reverse operation on the sub array of r1 and r2 in the range from x1 to x2.
For each operation a sub~key is constructed and recorded in a key~file. The sub~key is 6 tuple
and is given as follows, sub~key = (T, op, α1, α2, β1, β2) where
32
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
T = Transformation applied either row or column and takes values ‘R’ or ‘C’
Op = 0 or 1 or 2 (Meaning of these values changes for row and column operations)
α1, α2 = Two random rows or columns selected depending on the transformation
β1, β2 = min and max values of range for two selected α1, α2
In case of row transformation sub~key is recorded as, R op/r1/r2/x1/x2.
33
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
34
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
R 1/2/1/2/4, C 0/4/1/0/3
C 1/3/0/0/3, C 2/1/2/1/2
R 1/1/2/0/4, R 2/3/1/0/2
C 1/2/0/0/1
Figure 5: Content of the key~file
The process of disordering or scrambling the matrix elements based on sub~keys is explained in
figure 6.
3. DECRYPTION ALGORITHM
The proposed algorithm is a kind of symmetric encryption algorithm, with decryption process is
done by reversing the operations done in the encryption process. The cipher text is arranged into
a matrix of the same order in the encryption as m and n. The algorithm for decryption is given
in figure 7.
The steps of the decryption process explained in brief as follows
35
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
1. The key file is partitioned by the R (row) operations & C (col) operations. A sub key starts
from R or C operation, ends at the start of another R or C operation or the end of the key
file.
2. The sub keys are decrypted one by one from the last sub key to the first sub key.
3. For each sub key T, op, α1, α2, β1, β2 values are obtained whose terms are already
explained in the encryption algorithm. Based on T value either R or C operation is decoded
which are given as A = InverseRowTrans(A) and A = InverseColTrans(A).
4. In InverseRowTrans(A) depending on the value of ‘op’ transpositions are performed. For 0
right shifts, for 1 left shift and for 2 reverse operation is performed on the columns.
5. In InverseColTrans(A) depending on the value of ‘op’ transpositions are performed. For 0
downward shift, for 1 upward shift and for 2 reverse operation is performed on the rows.
6. The process is done until the key file is completed and at the end of process matrix A
contains the required original message i.e. plain text.
C 1/2/0/0/1, R 2/3/1/0/2
R 1/1/2/0/4, C 2/1/2/1/2
C 1/3/0/0/3, C 0/4/1/0/3
R 1/2/1/2/4
Figure 9: sub keys in reverse order
the algorithm. The input plaintext and the Random number and Binary sequence generated is
shown in the figure 11.
As per the algorithm, binary sequence is processed and the row or column is selected. The
operation to be performed is done based on the random number generated by the random
number generator. The first three rounds of operations are shown in the figure 12 and the next
three rounds in the figure 13. Each round operation’s output is also shown in the figures. For
every round operation a sub~key is generated and after every round of the operation the
sub~key is stored in a separate text file which is kept secret.
The contents of the key file are shown in figure 14. It can be seen that it contains the entire
sub~key’s generated after the completion of the encryption process. The number of sub~key’s
equal to the ‘w’ no of operations. This key file is sent along with the cipher text to the receiver.
Depending on the key file each sub~key is used in the reverse order for the decryption process
to get back the plaintext.
Now we present the graphs that represent the amount of text scrambled in the algorithm based
on the experimental results. The total count of operations is 6 and for every round the number of
transpositions performed can be seen in the figure 15. It can be observed form the figure that as
38
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
with the every round of operation is complete the amount of transpositions goes on increasing
resulting in the very good scrambled matrix. When the same plaintext is taken and when the
encryption is performed again then the transpositions will be different and resultant scrambled
matrix is also different. This can be observed in the figure 16.
Thus it is hard that we will be getting same result when we process the same text again and
again i.e. the scrambling is not same. It shows the efficiency of the algorithm and strong
encryption that is not vulnerable to cryptanalysis.
The value of parameter ‘w’ plays an important role in control the intensity of the encryption.
‘w’ should not be too small or too large. For a matrix of order m and n, e ≤ w ≤ 2e is good
39
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
choice to scramble the matrix, where e = max(m, n). Under this condition, time complexity of
our algorithm is O(e).
The second parameter ‘i’ also plays an important role in strengthening the intensity of
encryption along with the parameter ‘w’. The binary digit sequence of ‘i’ chosen also avoids
regularity in the resultant cipher text. The good choice of ‘i’ gives better binary sequence, which
is used to scramble the matrix in both directions row wise and column wise efficiently.
Our algorithm is based on magic rectangle, and hence it is easy to understand and easy to
implement the proposed algorithm, which also has the following characteristics.
1. Running Speed: The algorithm belongs to classis shifting encryption algorithm and it uses
only 3 kinds of linear array operations, circular horizontal shifting(left, right) , circular
vertical shifting(up, down) and reverse operations. So it works efficiently with little system
resources.
2. Simple Algorithm: Depending on shifting operations and reverse operation of the bi-
directional circular queue, the algorithm could be implemented by software as well as
hardware, which relax the limitation that most encryption algorithm needs to be
implemented by hardware.
3. Strong Encryption Intensity: For an n × n matrix, the encryption intensity of the algorithm
is nw
40
International Journal of Network Security & Its Applications (IJNSA), Vol.2, No.4, October 2010
REFERENCES
[1] W. Y. YE Yongwei and YANG Qinghua, (2003) “Magic cube encryption for digital image using
chaotic sequence”, Journal of Zhejiang University of Technology, 31(2):173–176.
[2] Z. L. Z. X. feng and FAN Jiu-lun, (2007) “A digital image encryption algorithm based on
chaotic sequences”, Microelectronics & Computer, 2.
[3] Kui-He Yang and Shi-Jin Niu, “Data Safe Transmission Mechanism Based on Integrated
Encryption Algorithm”, Staffordshire University.
[4] C. C. LUO Pu, (2006) “An image encryption algorithm based on chaotic sequence”, Journal of
Information, 12.
[5] S.-J.-b. BAO Guan-jun and JI SHI-ming, (2002) “Magic cube transformation and its application
in digital image encryption”, Computer Applications, 11:22–25.
[6] F. Y. LI Min, (2005) “A new class of digital image scrambling algorithm based on the method of
queue transformation”, Computer Engineering, 01(31):148–149.
[7] Z. X. L. Z. G. Chuan, (2006) “A digital image encryption algorithm based on chaotic
sequences”, Computer Engineering and Applications, 19.
[8] G. J. HUANG Xiaosheng, (2007) “Image encryption algorithm based on compound chaotic
sequence and wavelet transform”, Computer Engineering, 14.
[9] M. Morris Mano, (2001) “Digital Design”, Third Edition, Prentice Hall, pages (5-30).
[10] W. W. Yan Weimin, (1992) “Data Structure”, Tsinghua University Press, Beijing.
[11] X. Y. CHEN Tao, (2005) “Design and implementation of encryption algorithm based on n-
dimension magic cube”, Journal Of In- formation, 2:13–14.
Authors
Macharla Kiran Kumar1 received the Bachelor of Technology in Computer
Science & Engineering from Acharya Nagarjuna University, Guntur, India in
2004, and Master of Technology in Computer Science & Engineering from
Acharya Nagarjuna University, Guntur, India in 2009. He is working as a
Lecturer at the Department of Computer Science in R.V.R & J.C College of
Engg, Guntur, India. His main research interests are Data mining, Information
Security, Biometrics, web Information Retrieval, Image Processing, Discrete
Structures, and Network Security.
41