Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Proceedings of 2011 International Conference on Signal Processing, Communication, Computing and Networking Technologies (ICSCCN 2011)

Image Encryption Using Affine Transform and


XOR Operation

Amitava Nag, Jyoti Prakash Singh, Srabani Khan, Sushanta Biswas, D. Sarkar, Partha Pratim Sarkar
Saswati Ghosh Dept. of Engg. and Technological
Dept. ofInformation Technology , University of Kal y ani Kaly ani,
Aca demy of Technolog y Bandel, In dia
In dia

Abstract-Image encryption is a suitable method to protect image characteristic of multimedia d ata is totally different from text
data. Image and text data has their unique features. The d ata. Text d ata does not possess any redun dancy where as all
available encryption algorithms are good for text data. They may multimedia d ata has got a lot of redun dancy. The pixel value
not be suitable for multimedia data. In fact the pixels of natural
of a location is highly correlated to values of its neighboring
images are highly correlated to their neighboring pixels. Due to
pixels. Similarly , a soun d sample is correlated to its next
this strong correlation any pixel can be practically predicted
sample and its previous samples. This correlation proves to be
from the values of its neighbors. In this article, we propose a new
location transformation based encryption technique. We attack points to any stan d ard encryption algorithm. Because, if
redistribute the pixel values to different location using affine one can fin d out pixel value at a location or one soun d sample,
transform technique with four 8-bit keys. The transformed image then they can predict the values of neighboring pixels or next
then divided into 2 pixels x 2 pixels blocks and each block is soun d sample with reasonable accuracy.
encrypted using XOR operation by four 8-bit keys. The total key Most of the available encryption algorithms such as DES, AES
size used in our algorithm is 64 bit which proves to be strong [1], RSA [1] and IDEA [1] are used for text d ata. Even
enough. The experimental results proved that after the affine
though DES [1], AES[I], RSA[I] and IDEA[I] can achieve
transform the correlation between pixel values was significantly
high security, it ma y not be suitable for images and vi deos
decreased.
encryption d ue to the intrinsic characters of images and vi deos
Keywords- Image Correlation, Image encryption, Image
histogram, Affine transform, Symmetric key encryption.
such as large d ata size an d high redun dancy, encryption on
which needs their own special requirements and thus requiring
I. INTRODUCTION different encryption algorithms [9,10]. The image encryption

The exchangeof electronic data exchange is increasing algorithms can be classified into three major groups: (i)
rapi dly.With the fast evolution of electronic d ata exchange, position permutation based algorithm [6, 7], (ii) value
the unauthorized data access is also increasing. To protect this transformation based algorithm [3, 4, 5, 8] an d visual
unauthorized access information security is becoming ver y transformation based algorithm [6]. Younes et al. [14]
crucial in d ata storage an d transmission. Images are a ver y proposed a permutation based encryption algorithm. They
divi ded the original image into 4 pixels x 4 pixels blocks,
popular form of information and are used in ever y aspect of
life. The protection of image d ata from unauthorized access is which were rearranged into a permuted image using a given
very essential. Encryption techniques [1, 2] are ver y useful permutation process. The permuted image was then encrypted
tools to protect secret information. They protect the secret using the RijnDael algorithm. Their results showed that the
information b y converting the secret information to some correlation between image elements was significantl y
decreased b y using thecombination technique. Many
unintelligible form using a key. To get back the information
the encrypted information should be converted back to original encryption algorithms are based on chaotic maps [11]. Fridrich
information using some keys. Based on the key , the encryption [ ] proposed an encryption algorithm based on chaotic maps.
algorithm can be classified into two categories. They are (i) He used invertible chaotic two-dimensional maps to create
Symmetric key encryption and (ii) Asymmetric ke y new symmetric block encryption schemes. His scheme is
encryption. Symmetric key encryption algorithms uses same foun d to be useful for encryption of large amount of d ata, such
ke y for both encryption and decryption where as asymmetric as digital images. Guo and Yen [7] proposed an image
ke y encryption algorithms uses different keys for encryption encryption algorithm based on a binary sequence generated
an d decryption. from a chaotic system. They scrambled an image accor ding to

Asymmetric key algorithm has ver y higher computational the generated binar y sequence. This algorithm possesses low

costs which are most of the time prohibitive for multimedia computational complexity, high security an d no distortion.
d ata. Symmetric key encryption algorithms are comparativel y In this paper, we propose a two phase encryption and
decryption algorithms that is based on shuffling the image
lower cost an d ma y be use d for multimedia d ata. But the
pixels using affine transform and they encrypting the resulting

978-1-61284-653-8/11/$26.00 ©2011 IEEE 309


Proceedings of 2011 International Conference on Signal Processing, Communication, Computing and Networking Technologies (ICSCCN 2011)

image using XOR operation. We have used a key of 64 bit locations ranging from (1, 1) to (M, N). The pixel location (x,
length which is quite good for practical purposes. The affine y) where x E {O, 1,2,.. ,M -I} and y E {O, 1,2,.. ,N -I} of
transform fractures the correlation between adjacent pixels of secret image is transformed to new location " , y' by
an image. Affine cipher is one-to-one mapping, that is, a .'- lnod !I·t ,., '" ." '" ." '" 3
symbol in the plaintext can be transformed to a unique symbol
and
in the cipher text. In Affine cipher, the relationship between
y' = i( + K] X) '!fwd '" '" ." '" ." '" 4
the plaintext P and the cipher text C is given in equations 1
<

'..
and 2. The transformed image is then decomposed into � - number

of 2 2 blocks. Pixels inside each block are encrypted using


C = f{ K P itn.oa ,. "' "' 1
sub-keys K , Ke, K , and R .
.L 011 III 011 III

The details of the encryption

P' -
process are given in detail in algorithm 1.
.,
-

Algorithm 1: Encryption Algorithm


Wheregcd . S\. , , l{!- ! is the multiplicative inverse of
= 1

K! and (-K is the additive inverse of·K . The rest of the Input: A 256 gray level secret Image S of size M . Hf and a

article is organized as follows: In section 2, we propose our 64 bits secret Key


f
encryption and decryption algorithms. Section 2 also describes Output: A 256 gray level cipher Image B·t

the key selection procedure. The experimental results are Steps


discussed in section 3. We conclude the paper with a
1. Split 64 bits secret key into
discussion on current work and some directions to future
works in section 4. K , K1, K'2.' K3, K ..' Ks ' KG' an.d K
II. PROPOSED SCHEME 2. For each pixel P:.: ..y, transform the location
,
We propose our two phase encryption symmetric key (x, y) in S to x, in C using the formula
algorithm in this section. We have used a 64 bit symmetric :,."()= K
key. The 64 bits of key is divided into 8 sub-keys ,
= 'K,- - K.,., x · m.od III
J( , K!, � , ..11.3'
. K., Ke, K , and K of 8 bits each. The key
,"1 .'Ii
K

is chosen is in such a way that the first sub-key is relatively 3. Decompose C into -;- X � number of 2 X 2
prime to width of the image and the fourth sub-key is
blocks
relatively prime to the height of the image i.e.
9 " i· .,! ;; 1 (UI " c '! "a ,,\1, ;; 1. The reason of choosing 4. For each block Bij of C do
gcd K ,M = 1 (wd gcd K3,
t
f = 1 is that the transformed (a) P 1,1 :P1,1 :.L: K
coordinate will be unique in the range of 1 and M due to t
(b) p 1,'2 =P1..'2 :.L: Ks
g c d K , ... 1
. = 1 iand 1 to N due to g cd K;,. = 1. If the
t
sub-keys are not prime to height and width of the image the
(c) p '2,. l =P'2.. 1 :.L: KG
t
transformation process may map more than one location to (d) p '2.'2= P'2,'2 :.L: K7
same destinations. For example if Kl =32 and K2=6, then 5
(Where EB denotes XOR operation)
and 37 will map to the same location as follows:
5 32 + 6 % 25 6 = 166 5. End.
and 37 * 32 + 6 %256 = 166

The fIrst four sub-keys . S\. , J[ , �,K


all d K3 are used for
location transformation of the pixel values of the image using

affine cipher algorithm. Next four keys i{ , K , K , and K


are used for second level of encryption using simple XOR
operation. We use a location transformation of pixel values of
the image because image data has strong correlation among
adjacent pixels. This strong correlation proves to be a weak
point for any encryption algorithm. Anyone knowing a pixel
value may predict the neighbor pixel values reasonably well
using some prediction techniques. So, first of all,we break this
correlation among image pixels by transforming them into
new locations using affine transform. The detailed
implementation of affine transform is described by equations 3
and 4. Say, we have an image of size M X N with pixel

978-1-61284-653-8/11/$26.00 ©2011 IEEE 310


Proceedings of 2011 International Conference on Signal Processing, Communication, Computing and Networking Technologies (ICSCCN 2011)

Figure 1: 8-bit gray scale image of Lena


2. Decompose C into - number of 2 x 2

blocks
Decryption Technique 3. For each block Bij of C do
For decryption, the cipher image is first decomposed into (a) Decrypt P'1.,l asP1..1 .;pr 1.,1 :.t.: K
" N'
-=- x: -=- nwnber of 2 2 blocks. Each pixel of every block is (b) Decrypt P \, � asP 1.. � .;p \. � :.t.: K5
decrypted using XOR operation with 4 least significant bits
(c) Decrypt p'�,1 asP�.l .;p' �,1 ffi K6
sub keys K , K", K., ami R, . The decrypted pixels are then
restored back to their original position using equation 5 and 6. (d) Encrypt p'� . � as pt�,�= p�.� tJ K7
- .1 + -i{ x le man H 4. For each pixel �'r!f,yf , transform the location
) = )1 + - K ' Ka- man
(x'" in C to (x,y) in S using the formula
.1
-j

!l, X K! - ! than ;.I·f
!
) = )1 T -l(' K3- n,.oa 1
5. End
III. EXPERIMENTAL RESULTS

To validate our proposal we implemented our algorithm in


Matlab 7 running on Windows XP platform. We have used ten
8-bit gray scale images of size 256 X 256. One such image of
8-bit gray scale images of Lena of size 256 x 256 is shown in
Figure 1. The affine transformed image is shown in Figure 2
and fmal encrypted image is shown in Figure 3. The
histograms of original image, the affine transformed image
and XOR encrypted image is shown in Figure 4, 5 and 6.
Affine cipher transformation relocates the pixel values but
does not change those values as can be seen from the
histogram of fig 4 and 5. The histogram using XOR, changes
pixel values as shown in Figure 6. As the histogram in figure 6
shows the pixel values gets uniformly distributed which resist
any statistical attacks. The average correlation of neighboring
pixel values after the affine transform and the XOR operations
are shown in Tablel. As can be seen from Table 1 that the
correlation between neighboring pixel values are around .9
after affine transform and around 0.15 after XOR operation.

700

600

500

400

300

Figure 3: XOR encrypted affine transformed image of Lena 200

100
Algorithm 2: Decryption Algorithm
1 o
Input: A"1 Cipher Image C and a 64 bits secret Key

Output: A IH . H Secret Image S o 50 100 150 200

Steps Figure 4: Histogram of initial image of Lena

1. Split 64 bits secret key into

978-1-61284-653-8/11/$26.00 ©2011 IEEE 311


Proceedings of 2011 International Conference on Signal Processing, Communication, Computing and Networking Technologies (ICSCCN 2011)

neighboring pixels and make the image unidentifiable. The


700
XOR operation then change the pixel values making the image
600
very meaningless. The encryption and decryption process are
500 simple enough to be carried out on any large sized image or
video files, but provides enough security. The authors are
400
currently engaged in randomizing the application of keys so
300 that the security level is further increased.

200
REFERENCES

100

[I) w. Stallings,Cryptography and Network Security principles and practices,


o
3rd ed., Pearson Education, 2003.
o 50 100 150 200 250
[2) H. EI-din H. Ahmed, M. K Hamdy, and O. S. Farag Allah, "Encryption
Figure 5: Histogram of affine transformed image of Lena
quality analysis of the RC5 block cipher algorithm for digital images," Optical
Engineering, Vol. 45,Issue 10107003,2006
700
[3) Aloha Sinha, Kehar Singh, "A technique for image encryption using
600 digital signature", Optics Communications, Vol-2I8 (2203),229-234.

[4) S.S.Maniccam, N.G. Bourbakis, "Lossless image compression and


500
encryption using SCAN", Pattern Recognition 34 (2001),1229-1245

400
[5) Chin-Chen Chang, Min-Shian Hwang, Tung-Shou Chen, "A new
encription algorithm for image cryptosystems", The Journal of Systems and
300
Software 58 (200I),83-9I.

200
[6) Jiun-In Guo, Jui-Cheng Yen, "A new mirror-like image encryption
algorithm and its VLSI architecture", Pattern Recognition and Image
100 Analysis, vol.IO, no.2, pp.236-247,2000.

o [7) Jui-Cheng Yen and J. I. Guo, "A New Chaotic Image Encryption
Algorithm," Proc. 1998 National Symposium on Telecommunications,
o 50 100 150 200 25[ pp.358-362,Dec,1998.
Figure 5: Histogram ofXOR encrypted affine transformed
image of Lena [8) Shuqun Zhang and Mohammed A Karim, "Color image encryption using
double random phase encoding", MICROWAVE AND OPTICAL
TEC HNOLOGY LETTERS Vol. 21,No. 5,June 5 1999,318-322
Table 1: Average correlation between pixels values.
[9)M. V. Droogenbroech, R. Benedett, "Techniques for a selective encryption
of u ncompressed and compressed images," in Proceedings of Advanced
Concepts for Intelligent Vision Systems,2002,pp 9-1I.
Image name Correlation after Correlation
affine transform after XOR [IO)S. Changgui, B. K Bharat, "An efficient MPEG video encryption
algorithm," Proceedings of the symposium on rei iable distributed systems,
1998,pp. 38I -386.

Lena 0.9468 0.5088


[II) J. Cheng; J.1. Guo, "A new chaotic key-based design for image
encryption and decryption," The 2000 IEEE International Symposium on
Circuits and Systems, volA, no. 4, pp. 49 - 52, May. 2000.
Xplane 0.9283 0.4983
[12) S.Behnia,AAkhshani,S.Ahadpour,H.Mahmodi,A Akha-van, A fast
chaotic encryption scheme based on piecewise nonlinear chaotic maps,

Airplane 0.9971 0.2873 Physics Letters A 6(2007):39I-396.

[13)Jiri Fridrich, "Image Encryption Based on Chaotic Maps", Proceeding of

IV. CONCLUSION IEEE Conference On Systems, Man, and Cybernetics, pp. 1 105-II10, 1997.

In this article, we proposed a symmetric key image encryption [14) Mohammad Ali Bani Younes and Aman Jantan, Image Encryption Using
technique that first scramble the locations of the pixels using 4 Block-Based Transformation Algorithm, lAENG International Journal of
Computer Science,35:I,2008
8-bit sub keys and then encrypt the pixel values by XOR the
selected 8-bit key. The scrambling operation is done using
affine cipher techniques that breaks the correlations of the

978-1-61284-653-8/11/$26.00 ©2011 IEEE 312

You might also like