Proc. of Int. Conf. on Recent Trends in Information, Telecommunication and Computing, ITC

An Innovative Approach in Image Encryption Subhajit Das1, Satyendra Nath Mondal2 and Nabin Ghoshal3 1

NayagramBaniBidyapith, Nayagram,India Email: Subhajit.batom@gmail.com. 2 Kalyani Govt. EnggCollege,Dept.of Information Tech. Kalyani,Nadia,India Email: satyen_kgec@rediffmail.com 3 University of Kalyani, Dept. of Engg.andTech.Studies,Nadia, India Email: nabin_ghoshal@yahoo.co.in

Abstract— In this paper, a symmetric key image encryption algorithm has been proposed to encrypt image. At first, a large integer number is taken as input and a set of odious number has been computed from this number.A remainder set is computed by dividing the elements of odious set with 255, the maximum grey value of the image. The remainder set is act as symmetric key. The input image is diffused based on a set of predefined rules and compression technique. Finally, bitwise XOR operation has been applied between key and diffuse image. The effectiveness of the algorithm has been tested by number of statistical tests like histogram analysis, correlation, NPCR, UACI and entropy test. It has been observed that the proposed algorithm has given better result in all tests. Index Terms— Symmetric key, Odious number, If- then rules, Compression Technique and Statistical Test.

I. INTRODUCTION The role of Cryptography is most important in the field of network security. The main goal of cryptography is Confidentiality, Integrity, Authentication, Nonrepudiation. As different type of data has its own features, therefor different technique of encryption have been used for different data types [1].Due to large data size and real time constraints algorithm that are good for textual data may not be suitable for image encryption [2].Now a days fuzzy logic-one of the soft computing tool also applied by researchers for image encryption algorithm. Khamy,Lotfy and Hamdi Ali ([3],[4]) have proposed an encryption algorithm in combination form. The combination is made by permuted of position of image pixels and its transformed value. The pixels values are transformed randomly according to PN binary sequences. They have also given a Fuzzy Bit Generator (FBG) for generating binary sequences used in the encryption algorithm. A number of tests have been applied to prove the advantage in security level of proposed algorithm. Mohapatra,Sahoo and Mishra[5] have analysed the Advanced Encryption Standard (AES), and they have added some modification to provide enhanced security along with maintaining data integrity. In this paper, they have used Fuzzy Logic along with Secret Sharing Concept to provide finer and enhanced way of security and data integrity maintenance.AmitSahai et al. [6] have proposed a new type of Identity Based Encryption called Fuzzy Identity Based encryption. In their proposed scheme, a user with secret key for the identity‘id’ is able to decrypt a ciphertext encrypted with the public key ‘id1’if and only if id and id1are within a certain distance of each other as judged by some metric.Madanayake, Peiris, Ranaweera and Jayathilake[7] have proposed an DOI: 02.ITC.2014.5.96 © Association of Computer Electronics and Electrical Engineers, 2014

encryption algorithm based on fuzzy logic. Their proposed algorithm has been provided security level and their corresponding processing level based on various keys. They have also described the encryption/decryption process using fuzzy logic. The different cryptographies approach, their application on image encryption and various statistical techniques to measure their performances have been described ([8][14]). In this paper, an encryption algorithm has been applied on diffused image. The image has been diffused by set of if-then rules based on crisp set and a compression technique. To encrypt image five steps have been introduced in this paper .They are- key generation, image diffusion, encryption, decryption and recover plain image from diffuse image. In this algorithm, to produce key, a large integer number has been taken as a key value. Odious number from 1 to that particular number has been computed. A number with an odd number of 1â€™s in their binary expansion known as odious number. The key has been produced by taking remainder of all numbers divided by 255. Now, the range of grey value of the pixel has been divided into 16 equal crisp sets. The first set consist of grey scale value ranging from 0 to15, second set consist of value ranging from 16 to 31 and so on. The position of gray value of each pixel has been found into these sets and the value 1 has been assigned in the set where the pixel is present and â€œ0â€? has been assigned other 15 sets. That is 16 bits stream has been produced for each pixel. A simple bit compression technique has been applied to convert 16 bit sequence in to 8 bit. The diffused image has been produced to recalculate grey value of each pixel value after compression. A bitwise logical operation has been performed between the key and defused image and encrypted image has been produced. As the proposed approach based on symmetric key algorithm, the plain image has been recovered based on reverse application of this algorithm. The result has been tested using many statistical testing and it has been observed that the proposed algorithm has been given better result in all tests. II. PROPOSED ALGORITHM In this paper, the images are encrypted by a number of steps. The key is generated and it has been applied on the modified image pixels. The image pixels have been altered by a set of predefined rules and compression rules. The algorithm is divided into five parts key generation, image diffusion, encryption,decryptionand plain image reconstruction. A. Key Generation Input: A big Integer number Output: Set of reminders. Method: Step 1:- To take an Integer number (n) Step 2:- To generate a set by calculating all odious numbers from 2 to n. â„™= odious numbers (2â€Śâ€Ś.n). Numbers with an odd number of 1â€™s in their binary expansion known as odious number. Step 3:- To divide all odious numbers by 255 from P and store it into another set â„š; â„š=reminder (â„™/255); Step 4:- To return the set â„š B. Image Diffusion Input: - A grey scale image. Output: - Diffuse Image. Method : Step 1.The gray scale image is a set of pixels represented by matrix = { }Ă— Step 2.Each 8 bit pixel (a) is converted into a 16 bit stream (b). Such that â†” âˆ€ = 1,2,3, â€Ś â€Ś ; = 1,2,3 â€Ś . Eight bit binary equivalent of the elements of can be represented as = â€Ś â€Ś . . Where ,â€Ś, ,â€Ś..=0 or 1. Step 3.A set of predefined rule have been applied to each to obtain . Binary equivalent of the elements can be represented as â€Ś â€Ś . . where ,â€Ś, ,â€Ś..=0 or 1. = 159

Step 4.Conversion of eight bit to sixteen bit have been done by a set of rules. Rule 1:- If 0 ≤ ≤ 15 ℎ = 0000000000000001 Rule 2:- If 16 ≤ ≤ 31 ℎ = 0000000000000010 Rule 3:- If 32 ≤ ≤ 47 ℎ = 0000000000000100 Rule 4:- If 48 ≤ ≤ 63 ℎ = 0000000000001000 Rule 5:- If 64 ≤ ≤ 79 ℎ = 0000000000010000 Rule 6:- If 80 ≤ ≤ 95 ℎ = 0000000000100000 Rule 7:- If 96 ≤ ≤ 111 ℎ = 0000000001000000 Rule 8:- If 112 ≤ ≤ 127 ℎ = 0000000010000000 Rule 9:- If 128 ≤ ≤ 143 ℎ = 0000001000000000 Rule 10:- If 144 ≤ ≤ 159 ℎ = 0000001000000000 Rule 11:- If 160 ≤ ≤ 175 ℎ = 0000010000000000 Rule 12:- If 176 ≤ ≤ 191 ℎ = 0000100000000000 Rule 13:- If 192 ≤ ≤ 207 ℎ = 0001000000000000 Rule 14:- If 228 ≤ ≤ 223 ℎ = 0010000000000000 Rule 15:- If 224 ≤ ≤ 239 ℎ = 0100000000000000 Rule 16:- If 240 ≤ ≤ 255 ℎ = 1000000000000000. Step 5.A simple compression scheme has been applied to make each bij 8 bit sequence furnished in table I. TABLE I. SET OF RULES Rules. If( ≥ 0 ≤ 15) ℎ =

Decimal equivalent of bij 00000001

1

If ( ≥ 16 ≤ 31) ℎ =

00000010

2

If ( ≥ 32 ≤ 47) ℎ =

00000100

4

If ( ≥ 48 ≤ 63) ℎ =

00001000

8

If ( ≥ 64 ≤ 79) ℎ =

00010000

16

If ( ≥ 80 ≤ 95) ℎ =

00100000

32

If ( ≥ 96 ≤ 111) ℎ = 01000000

64

If ( ≥ 112 ≤ 127) ℎ = 10000000

128

If ( ≥ 128 ≤ 143) ℎ = 10000001

129

If ( ≥ 144 ≤ 159) ℎ = 10000011

131

If ( ≥ 160 ≤ 175) ℎ = 10000111

135

If ( ≥ 176 ≤ 191) ℎ = 10001111

143

If ( ≥ 192 ≤ 207) ℎ = 10011111

159

If ( ≥ 208 ≤ 223) ℎ = 10111111

191

If ( ≥ 224 ≤ 239) ℎ = 11111111

255

If ( ≥ 239 ≤ 255) ℎ = 00000000

0

Step 6. Reconstruct the image C. Image Encryption Input: - Diffused image, set of remainders of odious number (ℚ) Output: - Encrypted Image. Method: At this point logical XOR operation has been performed between each and each element of ℚstarting from left corner of the plain image, to obtain an encrypted image. If total number of is grater then the number of elements ℚ then ℚ taken as circularly. 160

D. Image Decryption Input: - An Encrypted image, set of remainders of odious number (ℚ) Output: - Diffused image. Method : To perform bitwise XOR between elements of set ℚ and grey value of pixels starting from left corner of the encrypted image. If the number of pixels > number of elements of ℚ then the elements of the ℚ is to be taken circularly. E. Image Reconstruction Input: - Diffused image Output: - Plain Image. Method: Middle value of each group have been used to obtained plain image .A set of predefined fuzzy rule based on their middle grey value described in table2, have been applied to each pixel of defused image. TABLE II. RULES FOR RECONSTRUCTION If( == 1) ℎ = 8 ;

Fuzzy Rules. 0 ≤ ≤ 15

If( == 2) ℎ = 24; 16 ≤ ≤ 31 If( == 4) ℎ = 40; 32 ≤ ≤ 47 If( == 8) ℎ = 56; 48 ≤ ≤ 63 If( == 16) ℎ = 72; 64 ≤ ≤ 79 If( == 32) ℎ = 88; 80 ≤ ≤ 95 If( == 64) ℎ = 104; 96 ≤ ≤ 111 If( == 128) ℎ = 120; 112 ≤ ≤ 127 If( == 129) ℎ = 136 ; 128 ≤ ≤ 143 If( == 131) ℎ = 152; 144 ≤ ≤ 159 If( == 135) ℎ = 168; 160 ≤ ≤ 175 If( == 143) ℎ = 184; 176 ≤ ≤ 191 If( == 159) ℎ = 200; 192 ≤ ≤ 207 If( == 191) ℎ = 216; 208 ≤ ≤ 223 If( == 255) ℎ = 232; 224 ≤ ≤ 239 If( == 0) ℎ = 248;

240 ≤ ≤ 255

III. EXPERIMENTAL ANALYSIS Experimental analysis of the new algorithm is presented here with several images shown in Fig. 1. The key has been generated with the number as 98765 and it has been applied on Lena image. The encrypted image has been decrypted with right and one bit changed on same number i.e. wrong key are shown in Fig. 2(a), Fig. 2(b), Fig. 2(c) and Fig. 2(d). From this experiment, it has been observed that the proposed encryption algorithm is sensitive to the key, even a single bit change of the key will generate a completely different decryption result and cannot get the correct plain-image.

(a)

(b)

(c)

(d)

Fig 1:- input images a) lena b) Babunc)monalisa d) hille)leaves

161

(e)

(a)

(b)

(c )

(d )

Fig 2:- Image encryption and decryption result. a) Plain image b) Encrypted image c) Decrypted image d) Decrypted image with a wrong value

A. Histogram Analysis The histograms of five encrypted images are shown inFig. 3.In all these histograms, the frequencies of pixels are uniformly distributed. It demonstrated that the encryption algorithm has covered up all the characters of the plain image and shows good performance of balanced 0â€“1 ratio, zero correlation and high-level security. Histogram analysis is also demonstrated that it is very difficult for an attacker to extract the pixels statistical nature of the plain image from the encrypted image. Image name Lena

Histogram plain image

Histogram encrypted image

Babun

Monalisa

Hill

Leaves

FIG 3 :- Histogram of plain images and their corresponding encrypted image

B. Differential Attack Analysis Two criteria NPCR and UACI are used to test the sensitive of a single bit change the plain-image. Number of pixels change rate (NPCR) denotes the percentage of different pixel numbers between two encrypted images, whose plain images have only one pixel difference. Unified average changing intensity (UACI) denotes the average intensity of differences between 2 cipher images, whose corresponding plain images have only one pixel difference. Suppose cipher text images before and after one pixel change in a plaintext image are C 1 and C2, respectively; the pixel value at grid (i, j) in C1 and C2 are denoted as C1(i, j) and C2(i, j); and a bipolar array D is defined in Eqn.(1). Then the NPCR and UACI can be mathematically defined by Eqns.(2) and (3), respectively, where symbol T denotes the total number pixels in the ciphertext, symbol F denotes the largest

162

supported pixel value compatible with the cipher text image format, and |.| denotes the absolute value function. 0 if C 1 (i , j ) = C 2 (i , j ) (1) D (i , j ) = 1 if C 1 (i , j ) ≠ C 2 (i , j ) D(i , j ) NPCR: N C 1 , C 2 = ∑ × 100% (2) T i, j

(

(

)

1

UACI: U C , C

2

)= ∑ i, j

C 1 (i, j ) − C 2 (i, j ) F •T

× 100%

(3)

It is clear that NPCR concentrates on the absolute number of pixels which changes value in differential attacks, while the UACI focuses on the averaged difference between two paired cipher text images. The range of NPCR and UACI is [0,1]. NPCR = 0 implies that pixels C1 and in C2 remains unchanged, whereas NPCR = 1 implies that all pixel in C2 are changed compared to those in C1. NPCR = 1 is thus ideal value and very difficult to obtain. The value of NPCR to an image (Lena) is 99.5550% and UACI is 33% respectively. This resultis indicated that small change in plain image creates significant changes in the ciphered images, so the proposed algorithm is highly resistive against differential attack. C. Information Entropy Analysis To analyse the robustness of the encryption algorithm, the concept of entropy is defined as

H ( m ) = ∑ p ( m i ) log 2

1 p (mi)

(4) Where p(mi)represents the probability of the symbol (pixel value) (mi) .Theoretically, a true random system should generate 2 8 symbols with equal probability, i.e., m= {m1,m2,m3,….m2 8 } m for bit depth 8.Table no III shows the entropy of the plain image and ciphered image. TABLE III:- ENTROPY OF DIFFERENT PLAIN AND E NCRYPTED IMAGE Image Lena Babun Monalisa Hill Leave

Plain image 7.7460 7.4712 7.4869 7.7684 7.6554

Ciphered image 7.9554 7.9843 7.9757 7.9764 7.9751

From the above table, it is cleared that entropy value of cipher images are slightly differ from 8 and they have proved the ability against the entropy attack. E. Correlation Coefficient To calculate the correlation coefficient of each pair by using the following formulas E ( x) =

1 N

N

∑

xi

i =1

(5)

1 N D( x) = ∑ ( xi − E ( x))2 N i =1

(6 )

1 N COV ( x, y ) = ∑ ( xi − E ( x))( yi − E ( y )) N i =1

(7)

r =

C O V ( x, y ) D (x) D( y)

(8) where x and y are grey-scale values of two adjacent pixels in the image. The correlation coefficients of horizontal, vertical and diagonal pixels of input image Babun are shown in Table IV. The correlation distribution of two horizontally adjacent pixels in the plain-image and that in the ciphered image are shown

163

in Fig. 4.These correlation analysis is proved that the proposed encryption algorithm satisfy zero cocorrelation. TABLE IV: C ORELATION C OEFFICIENT OF TWO IMAGES

Horizontal Vertical Diagonal

Input image 0.9712 0.9687 0.9861

Ciphered image 0.0035 0.0043 0.0038

(a)

(b) Fig 4:- Correlations of two horizontally adjacent pixels in the plain-image and in the cipher-image: (a) correlation analysis of plainimage,(b) correlation analysis of cipher-image

F. Peak Signal To Noise Ratio The PSNR is commonly used as measure of quality reconstruction of image. The signal in this case is original data and the noise is the error introduced. The high value of PSNR isindicating the high quality of image. It is the measurement which indicates the changes in pixel values between the plaint text and cipher text image. PSNR is defined as '×(×*+

! = 10 × "#$% &∑E@A ∑?@A FCD

+ BCD (:(,)<>(,))

&

(9)

Where the size of image be M×N .P(i,j) and C(i,j) are the value at location (i,j) in plain image and cipher image respectively. The PSNR values for plain image and decrypted image are furnished in table V .These are proved that the decryption algorithm has given high quality image. 164

TABLE V. IMAGES AND ITS PSNR VALUES Image name Lena Babun Monalisa Hill Leave

PSNR between input & decrypted image 42.8648 39.6372 39.7493 38.2848 42.94

IV. CONCLUSION AND FUTURE WORK In this paper, a symmetric key has been applied on diffuse image and the plain image has been diffused based on if-then rules and compression techniques. The encrypted image has been produced after applying the XOR operation between the diffused image and key. A single bit change in the key has been generated a completely different decryption result that proved the sensitivity of algorithm.It is very difficult for an attacker to extract the pixels from encrypted image pixels as the distributions of pixels of encrypted images are uniform. The high values of NPCR and UACI are indicated that the algorithm is highly resistive against differential attack. The entropy values of encrypted images are almost nearly 8. It proved that the distributions of pixel values are almost distributed from 0 to 255. The correlation values between plain images and encrypted images are almost zero and it is indicated that there is no correlation between input and encrypted images. The high values of signal to noise ratio are also indicated that the algorithm is properly decrypted the encrypted images. Now, considering the result of all the tests, it has been observed that the proposed algorithm is a simple, straight-forward but intrinsically strong and compact approach to cryptography. It has been provided the same or sometimes even better level of security using minimal time complexity. A comparative study and security level will be verified in future with other well-known algorithms. ACKNOWLEDGMENTS The authors would like to thank to the All India Council for TechnicalEducation (F.No20/AICTE/RIFD/RPS/(POLICY-1)43/2013-14) for funding this research work. REFERENCES [1] Mohammmad Ali BaniYounes and Amanjantan, “Image Encryption Using Block Based Information Algorithm”,IAENG, International Journal of Computer Science,Vol35, Issue 1,pp1-9,2008. [2] M.V. Droogenbroech,R.Benedett, “Technique for a Selective Encryption of Uncompressed and Compressed Images “,Proceedings of Advance Concepts for Intelligent Vision System(ACIVS 02),Ghent ,Belgium,pp90-97,2002. [3] Said E. El- Khamy, Mona Lotfy, and Adel Hamdi Ali, “A New Fuzzy Logic Based Pseudo-Random Bit Generator for Secure DS-CDMA Systems”, Proceedings of 22nd URSI NRSC Conference, Cairo, Egypt,pp377-384, March 2005. [4] Said E. El- Khamy1, Mona Lotfy, and Adel Hamdi Ali, “A new fuzzy PN codes based color imageencryption technique”,Proceedings of XXVIIIth URSI General Assembly, New Delhi,pp1-4, 2005. [5] AnuragMohapatra,Madhabanandasahoo, Ashis Kumar Mishra,” Message security and integrity maintenance using fuzzy logic and secrey sharing”, International Journal of Scientific & Engineering Research, Volume 4, Issue 5,pp1055-1058,2013. [6] AmitSahai Brent R. Waters,” Fuzzy Identity Based Encryption”. In: Cramer, R. (ed.) EUROCRYPT 2005. LNCS, Vol. 3494, Springer, Heidelberg,pp. 457–473, 2005. [7] RavinduMadanayake, NikilaPeiris, GayanRanaweera andUthpalaJayathilake , “Advanced Encryption Algorithm Using Fuzzy Logic”, IPCSIT Vol. 27 © IACSIT Press, Singapore,pp32-36,2012. [8] C.E.Shannon, “Communication Theory of Security System”,Bell,System Technical Journal, Vol28, 1949. [9] Ari Juels and Martin Wattenberg,“A fuzzy commitment scheme”, Proceedings of the 6 thACM conference on Computer and communications security, ACM Press, pp28–36. 1999. [10] W. Diffie and M. E. Hellman, “Privacy and authentication: an introduction to cryptography,” Proceedings of the IEEE, Vol. 67, pp. 397-427, 1979. [11] Gamil R.S. Qaid , Sanjay N. Talbar, “Encryption and Decryption of Digital Image Using Color Signal” IJCSI International Journal of Computer Science Issues, Vol. 9,Issue 2, No 2, PP. 588 -592,2012.

165

[12] Schneier B,” Applied Cryptography - Protocols, Algorithms and Source Code in C”, Second Edition ,New York, John Wiley & Sons, 1996. [13] A.M. Goon, M. K.Gupta, B. Dasgupta“ Fundamental of Statistics”, Vol 1, World Press Ltd,1991. [14] Uttam Kr. Mondal , Satyendra Nath Mandal , J. PalChoudhury, J.K.Mandal, “A New Approach to Cryptography”, International Conference Systematics, Cybernatics& Informatics (ICSCI 2008) , pp 1-12,2008.

AUTHORS INFORMATION Subhajit Das received his degree M.Sc. (Computer Science) from Vidyasagar University and MBA (IS) from Sikkim Manipal University. Presently he is working as an Assistant Teacher of Computer Science in NayagramBaniBidyapith. He is currently a Ph.D. Scholar, in the field of Cryptography and Network Security. He has 3 years of research experience. He has, published six papers in international conferences and journals. Satyendra Nath Mandal received his B.Tech&M.Tech degrees in Computer Science & Engineering from university of Calcutta, West Bengal India. This author is AICTE Career Award for Young Teachers (CAYT) awarded from All India Council for Technical Education (AICTE) on 2010. He is now working as Assistant Professor in Department of Information Technology at Kalyani Govt. Engg. College, Kalyani, Nadia, West Bengal, India. His field of research areas includes cryptography & network Security, fuzzy logic, Artificial Neural Network, Genetic Algorithm etc. He has about 60 research papers in National and International conferences. His eleven research papers have been published in International journals. Dr.Nabin Ghoshal is currently attached with the Department of Engineering & Technological Studies, University of Kalyani, Kalyani, West Bengal, India. He received his MCA degree from University of North Bengal in 1998. He has finished his M. Tech. in Computer Science and Engineering form University of Kalyani. He received his Ph. D. degree in Computer Science & Engineering from University of Kalyani in 2011. Dr.Ghoshal has 35 research papers in various international journals and national and international conferences. He wrote a book in his research area.

166

Advertisement