Professional Documents
Culture Documents
Image Encryption Using Affine Transform and XOR Operation
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
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
P' -
process are given in detail in algorithm 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
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
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
700
600
500
400
300
100
Algorithm 2: Decryption Algorithm
1 o
Input: A"1 Cipher Image C and a 64 bits secret Key
200
REFERENCES
100
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.
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