You are on page 1of 5

Proceeding International conference on Recent Innovations is Signal Processing and Embedded Systems (RISE -2017) 27-29 October,2017

Comparative Study of AES, RSA, Genetic, Affine Transform with


XOR Operation, And Watermarking for Image Encryption

Avinash Ray 1, Anjali Potnis2, Prashant Dwivedy3, Shahbaz Soofi 4, Uday Bhade5
Department of Electrical & Electronics Engineering
National Institute of Technical Teachers’ Training & Research Bhopal (Madhya Pradesh) INDIA.
atulasn03@outlook.com 1, apotnis@nitttrbpl.ac.in2, dwivedyfamily@gmail.com3, shahbaz_261@yahoo.com4,
udaybhade1991@gmail.com5

Abstract— In present scenario whole world is moving towards the use of one- way functions that are easy to compute in one
digital communication for fast and better communication. But in direction but very difficult to compute in reverse. This is what
this a problem arises with security i.e. when we have to transmit allows you to publish your public key, which is derived from
information (either data or image) over internet or to store your private key e.g.:- RSA algorithm
information at any random location then its security is very
important. To protect our information from hackers we use a In this paper we take an image as our information and try to
technique i.e. Encryption. In this paper we use image as encrypt it with different image encryption technique. After
information and use different types of encryption techniques to encryption we use parameters such as PSNR, MSE,
encrypt it and protect it from hackers. After that we find various Normalized Absolute Error, Average Difference, Structural
parameters from each image encryption technique and then
content, Maximum Difference to check which one technique is
compare each technique's parameters from one another. After
that we search for the best result and then proceed forward with best for image encryption.
that technique for future scope.

Keywords:- Image encryption; AES encryption algorithm; RSA II. THEORY BEHIND THE PROPOSED IMAGE
encryption algorithm; Affine Transform with XOR; Image ENCRYPTION TECHNIQUES
decryption; PSNR; MSE; NAE; AD;
A. AES Algorithm

It is also known as Rijndael [2]. The AES algorithm was


I. INTRODUCTION
developed by Vincent Rijmen and Joan Daemen. In October
A In recent scenario information transmission is being done 2000 NIST accepted that AES algorithm is the best algorithm
through electronic means such as internet. Internet is an open in security, performance, efficiency, ability of implementation,
medium, so there is chance of data hacking while it is being and also flexibility. The AES algorithm is symmetric key
transmitted. Another problem arises with data storage. That is algorithm, in this both sender and receiver uses same key to
sometimes some crucial information is stored in devices which encrypt data into cipher and to decrypt cipher into original data.
are of public use. So at that time there is chance of piracy of In this algorithm it has a fixed block length of 128 bits, while
data. To protect the data from attack a technique called the length of key size can be of 128, 192, or 256 bits. AES [3]
encryption is used. is an iterative algorithm. It is composed of 4 basic operational
blocks. For complete encryption iteration is performed up to
Encryption is a process which uses finite set of instructions “N" times. The total number of iteration i.e. N can be 10, 12,
called an algorithm [1] to convert original message known as and 14 based on key length i.e. 128, 192, and 256 respectively.
plain text, into encrypted form (or coded form) known as
cipher text. Cryptographic algorithms require a set of character 1) Encryption: Key Expansion Round keys are derived
called as ‘key’ to encrypt or decrypt data. With the help of key from the cipher key using Rijndael's key schedule. AES
and algorithm we can encrypt or decrypt plain text into cipher requires a separate 128-bit round key block for each round plus
text and then cipher text to plain text. one more.
a) Initial Round: Add Round Key, each byte of the
Encryption is of two types. One is Symmetric Algorithm which state is combined with a block of the round key
is also called as shared secret encryption. This form of using bitwise XOR.
encryption uses a secret key, called the shared secret, to b) Iterative Round’s:
convert data into cipher text. The person on the other end needs ƒ Sub Bytes, a non-linear substitution step
the shared secret (key) to unlock the data. It is called where each byte is replaced with another
symmetric cryptography because the same key is used on both according to a lookup table.
ends for both encryption and decryption e.g.:- Genetic x Shift Rows, a transposition step where the last
algorithm. The other is Asymmetric Algorithm which is also three rows of the state are shifted cyclically a
called Asymmetric cryptography. It is usually implemented by certain number of steps.
ISBN 978-1-5090-4760-4/17/$31.00©2017 IEEE

274
ƒ Mix Columns, a mixing operation which 1) Encryption: Take an image as input. Calculate its
operates on the columns of the state, Height (H) and Width (W) of the input image. Find (H mod 8)
combining the four bytes in each column. and (W mod 8), if they are equal to zero then go to next step.
ƒ Add Round Key
H = H + (8 - (H mod 8)) (3)
c) Final Round: Sub Bytes, Shift Rows, Add Round
Key W = W + (8 - (W mod 8)) (4)
2) Decryption: Inverse sub bytes, inverse shift rows and Divide input image in two blocks, each block size is of
inverse mix columns are used in reverse order instead of sub (8x8). Perform crossover operation. Perform mutation
bytes, shift rows, and mix columns. The key expansion remains operation get an encrypted block. Repeat last two steps for
the same. Fig 1 shows the original, encrypted and decrypted each block to get an encrypted image.
image in Matlab. Table 1 is a comparison of different quality 2) Decryption: Take encrypted image as input. Go to
parameters using AES algorithm. encrypted block. Perform mutation operation followed by
crossover operation to get decrypted block. Repeat last two
B. RSA Algorithm steps for each block to get decrypted image. Fig 3 shows the
original, encrypted and decrypted image in Matlab. Table 3 is
RSA is an algorithm developed in 1977 by Ron Rivest, Adi a comparison of different quality parameters using genetic
Shamir, and Leonard Adleman[4]. In such a cryptosystem, the algorithm
encryption key is a public one and the decryption key which is
different from the encryption key is kept private. As two D. Affine Transform with XOR operation
different keys are being used in encryption and decryption the Affine Transformation is a technique in which we can
RSA algorithm is also called as an asymmetric cryptographic
change the original pixel value to a different location with the
algorithm.
help of an 8 bit key. Then the image which is to be
The RSA algorithm consists of three major steps in encryption
transmitted is divided into 2x2 pixel blocks and then each
and decryption. The steps are as following
block is encrypted with the XOR Operation by four 8 bit keys
1) Key Generation: The RSA involves a public key and a [11]. The total key size used in this algorithm is 64 bits. The
private key. Of these two keys the public key is used for relationship between plain text (P) and cipher text (C) is
encrypting messages and can be known to everyone. The given by
messages encrypted with the public key are decrypted using
the private key. The process for key generation is as follows.
First choose two distinct prime numbers p and q and then C = (K0 + K1 x P) mod N (5)
compute n=pxq where n is the modulus for the public key and P = (C + (-K0) x 1/K) mod N (6)
the private keys. Next compute φ(n) = (p − 1)(q − 1). Choose
an integer e such that 1 < e < φ(n) and GCD (e, φ(n)) = 1. The 1/K is the multiplicative inverse of K1 and (-K0) = additive
pair (n, e) is the public key. The private key is a unique integer inverse of K0. The HCF of (K1, N) = 1.
d obtained by solving the equation d⋅e ≡ 1 (mod φ(n)).
1) Encryption: Take an image S of size M x N and a secret
2) Encryption: The RSA algorithm is used here for key of 64 bits. Break 64 bits key into eight equal parts i.e. (K0,
encrypting an image. So the message text (m) is in the form of K1, K2, K3, K4, K5, K6, and K7). The four sub keys (K0, K1,
pixels lying in the range 0 to 255. The pixels are stored and K2 and K3) are used for location change of pixel value and next
operated upon in an array format. The text is encrypted using four keys (K4, K5, K6 and K7) are used for encryption using
the public key (n, e) from the equation XOR Operation. For every pixel P x, y changes the location (X,
Y) in S to (X', Y') in C by formula
c=me mod (n) (1)

3) Decryption: The text is decrypted using the private key (n,


d) from the equation X' = (K0 + K1 x X) mod M (7)

m=cd mod (n) (2) Y' = (K2 + K3 x Y) mod N (8)


Break C into M/2 x N/2 number of 2 x 2 blocks. Now XOR
C. Genetic Algorithm Operation is performed for each block according to the
following equations
Genetic Algorithm (GA) is a penetrating technique used in
computer science to find out approximate solution [5] to P'1, 1 = P1, 1 XOR K4 (9)
optimization problems. Genetic Algorithm (GA) is first
proposed by John Holland and his contemporaries at the P'1, 2 = P1, 2 XOR K5 (10)
University of Michigan in 1975. Genetic Algorithm [6] is a P'2, 1 = P2, 1 XOR K6 (11)
particular class of evolutionary algorithm that used techniques
inspired from human evolution or evolutionary biology like P'2, 2 = P2, 2 XOR K7 (12)
inheritance, mutation, natural selection and recombination (also 2) Decryption: Take a cipher image C [9] of size M x N
called crossover). and a secret key of 64 bits. Break the 64 bits key into eight
equal parts i.e. (K0, K1, K2, K3, K4, K5, K6, and K7). Break C

275
269
into M/2 x N/2 number of 2 x 2 blocks. Then XOR Operation is
performed for each block
Decrypt P’1, 1 as P1, 1 = P'1, 1 XOR K4 (13)
Decrypt P'1, 2 as P1, 2 = P'1, 2 XOR K5 (14)
Decrypt P'2, 1 as P2, 1 = P'2, 1 XOR K6 (15)
Decrypt P'2, 2 as P2, 2 = P'2, 2 XOR K7 (16)
For every pixel P x', y' changes the location (X', Y') in C to (X,
Y) in S by formula [10]
X = (X' + (-K0)) x 1/K1) mod (17) Fig 1.Encrypted and decrypted image using AES algorithm
Y = Y' + (- K2)) x 1/K3) mod N (18)
Fig 4 shows the original, encrypted and decrypted image in
Matlab. Table 4 is a comparison of different quality parameters
using affine with XOR algorithm.
E) Watermarking Technique
Watermarking [11] is a technique which is used to
provide authenticity by using signature, stamp etc. A message
usually a logo, stamp, or a signature is superimposed onto an
image with a great deal of transparencies e.g.:- Money Fig 2.Encrypted and decrypted image using RSA algorithm.
watermark
Normally in watermarking the duplicate image is
superimposed over an original image and after that we get a
new image that is called as watermarked image [12].
For doing encryption however in this paper we use the
watermark as our original information say w which can be
watermarked on any image here say i. Thus our watermark
image will not be visible after superimposing it on another
image. So we say our image in encrypted. At the decryption
Fig 3. Encrypted and decrypted image using genetic algorithm
end this watermark w can be separated from the image i to
get the original information back.
1) Encryption:
Watermarked image = (1 – q) × i + (q × w) (19)
2) Decryption:
I = Watermarked image – (q × w)) / (1 – q) (20)
W = Watermarked image – (1 – q) × i) / q (21)
Fig 5 shows the original, watermarked and extracted image in
Matlab. Fig 6 shows the extracted watermark. Table 5 is a
comparison of different quality parameters using watermarking
technique.
III. EXPERIMENTAL RESULTS Fig 4. Encrypted and decrypted image using Affine with XOR algorithm.

The test image is encrypted using the various encryption


algorithms in the following order
1) AES algorithm
2) RSA algorithm
3) Genetic Algorithm
4) Affine with XOR algorithm
5) Watermarking

Fig 5. Original Image, Watermarked Image, Extracted Image

276
270
TABLE 2. PERFORMANCE MEASUREMENT PARAMETERS FOR RSA
ALGORITHM.

Comparison between Comparison


Quality Parameters Original Image and between Original
Encrypted Image Image and
Decrypted Image
Mean Square Error
14568 0
Fig 6. Extracted Watermark Peak Signal to Noise
Ratio
IV. PERFORMANCE PARAMETERS 6.4968 99
Normalized Absolute
To be able to tell which the most suitable encryption Error
technique [13] the following quality measurement parameters 0.8811 0
are employed once between original image and encrypted Normalized cross
image and once between original image and decrypted image. correlation
The image used for experimental analysis is cameraman.tif 0.1038 1
which is an in built Matlab image file. Average Difference

109.222 0
x Mean Square Error (MSE)
Structural Content 56.1716 1
x Peak signal to Noise Ratio (PSNR) Maximum Difference
x Normalized Absolute Error (NAE) 248 0

x Normalized cross correlation (NCC)


x Average difference TABLE 3. PERFORMANCE MEASUREMENT PARAMETERS FOR GENETIC
ALGORITHM.
x Structural content
Comparison between Comparison
x Maximum difference Quality Parameters Original Image and between Original
Encrypted Image Image and
TABLE 1. PERFORMANCE MEASUREMENT PARAMETERS FOR AES Decrypted Image
ALGORITHM. Mean Square Error
Comparison between Comparison 16256 0
Quality Parameters Original Image and between Original Peak Signal to Noise
Encrypted Image Image and Ratio
Decrypted Image 6.0207 99
Mean Square Error Normalized Absolute
94434 0 Error
Peak Signal to 1.0650 0
Noise Ratio Normalized cross
8.3795 99
correlation
Normalized 0.4718 1
Absolute Error Average Difference
0.6700 0
Normalized cross 22.8376 0
correlation Structural Content 1.1799 1
0.8394 1
Maximum Difference
Average
159 0
Difference
-8.5740 0

Structural Content 0.8307 1


Maximum TABLE 4. PERFORMANCE MEASUREMENT PARAMETERS FOR AFFINE
WITH XOR ALGORITHM.
Difference 247 0

Comparison between Comparison


Quality Parameters Original Image and between Original
Encrypted Image Image and
Decrypted Image

277
271
Mean Square Error parameters. Mean Square Error (MSE) for AES is obtained
11664 0 maximum that is it has the highest difference between original
image and encrypted image providing more security. PSNR for
Peak Signal to Noise watermarking is maximum but it has the least MSE proving it
Ratio
7.4623 99
to be a less secure technique. In future these all techniques can
be applied in a hybrid manner so as to make more complicated
Normalized Absolute and secure algorithm for image encryption.
Error
0.7562 0 REFERENCES

Normalized cross
correlation 1 Federal Information Processing Standards Publications (FIPS 197),
"Advanced Encryption Standard (AES) ", 26 Nov. 2001.
0.9753 1
2 J.J. Amador, R. W.Green “Symmetric-Key Block Cipher for Image and
Text Cryptography”: International Journal of Imaging Systems and
Average Difference Technology, No. 3, 2005, pp. 178-188.
-31.6142 0 3 H. Cheng, L. Xiaobo, Partial encryption of compressed images and
videos. IEEE Trans. Signal Process. 48 (8), 2439–2451, 2000.
Structural Content 0.6253 1 4 J.C. Yen, J.I. Guo, An efficient hierarchical chaotic image encryption
algorithm and its VLSI realization, IEEE Proc. Vis. Image Process. 147
(2000) 167–175.
Maximum Difference 5 H H. Cheng, X.B. Li, Partial encryption of compressed image and
251 0 videos, IEEE Trans. Signal Process. 48 (8) (2000) 2439–2451.
6 S. Li, X. Zheng, Cryptanalysis of a chaotic image encryption method, in:
Proceedings of the IEEE International. symposium on circuits and
systems, Scottsdale, AZ, USA, 2002.
7 Chin-Chen Chang, Min-Shian Hwang, Tung-Shou Chen, "A new
encription algorithm for image cryptosystems", The Journal of Systems
TABLE 5. PERFORMANCE MEASUREMENT PARAMETERS FOR and Software 58 (200 I), 83-9 I.
WATERMARKING TECHNIQUE.
8 Sandeep Bhowmik, Sriyankar Acharyya, “Image cryptography: the
Genetic algorithm approach”, IEEE, vol. 3, pp. 223-227, 2011.
9 Mohammed A.F. Al-Husainy, “Image encryption using Genetic
Comparison between Comparison algorithm”, Information Technology Journal, vol. 3, pp. 516-519. 2006.
Quality Parameters Original Image and between Original 10 Anil Kumar, M. K. Ghose, “Overview of information security using
Encrypted Image Image and Genetic algorithm and Chaos”, Information Security Journal: A Global
Decrypted Image Perspective, vol. 18, pp. 306-315, 2012.
11 Amol R. Madane, K.T Talele,M.M Shah, “Watermark Logo in Digital
Mean Square Error Image using DWT, Proceedings of SPIT-IEEE Colloquium and
714.5421 0 International Conference,Vol.1.
12 Akhil Pratap Singh, Agya Mishra, “Wavelet Based Watermarking On
Peak Signal to Noise Digital Image”, Indian Journal of Computer Science and Engineering,
Ratio Vol.1, No.2, 86-91.
19.5905 329.76 13 Amol R. Madane, K.T Talele,M.M Shah, “Watermark Logo in Digital
Image using DWT, Proceedings of SPIT-IEEE Colloquium and
Normalized Absolute International Conference,Vol.1.
Error
0.1992 0

Normalized cross
correlation
23.6450 1

Average Difference

23.6450 0
Structural Content 1.5599 1

Maximum Difference
50.4029 0

V. CONCLUSION

In this paper a detail study of various encryption techniques has


been made. All technique except watermarking, give an ideal
decrypted image which has been verified by different

278
272

You might also like