An Adaptive Dual Image Encryption Ramyashree A.N1 4th Sem, M.Tech (DECE) Dept. Of Electronics & Communication Engineering. Akshaya Institute of Technology, Tumkur ramyanarayan.an26@gmail.com, Abstract-Information must be secure in the fast growing internet technology. To secure the information encryption is also used. Integrity and Cryptography are the core principles of information security. Integrity means that data cannot be modified undetectably. The hash functions in cryptography are message integrity. This paper presents an approach to improve the entropy of an encrypted image using hill-cipher and to provide authentication. Dual image encryption process involves the following three stages. In first stage, Hill-cipher with invertible matrix or Hill cipher with non-invertible matrix are applied, depending on the switch value. In stage two each pixels of both the images are bitwise rotated and reversed to change the pixel value. In third stage, higher nibbles in each pixel of two resultant images are exchanged, finally get encrypted images. Keywords—Hill cipher, bit-rotation, nibble exchange, entropy, SHA. I. INTRODUCTION The advent of electronic commerce applications, an urgent need to solve the issue of information security in an open network environment is required. Encryption is a method of transforming original data, called plaintext or clear text, into a form that appears to be random and unreadable, which is called cipher text. Plaintext is either in a form that can be understood by a person (a document) or by a computer (executable code). Once it is not transformed into cipher text, human nor can machine properly process it until it is decrypted. This enables the transmission of confidential information over insecure channels without unauthorized disclosure. When data is stored on a computer, it is usually protected by logical and physical access controls. When this Manjunatha C.N2 Lecturer, Dept. Of Electronics & Communication Engineering. Akshaya Institute of Technology, Tumkur, cnmmanjunath@gmail.com same sensitive information is sent over a network, it can no longer take these controls for granted, and the information is in a much more vulnerable state. So many methods for image encryption with some advantages and disadvantages. Panduranga H.T et. al [1] have presented a novel image encryption technique using multi wave based carrier image. Here carrier image pixels are created by amplitude values of multiple sine waves generated by alphanumeric password. S. R. M. Prasanna et. al[2] presented an image encryption method with magnitude and phase manipulation using carrier images. They used the concept of one dimensional Discrete Fourier Transform and carrier images for encryption purpose. Ismail I.A et.al[3] presented novel technique for the existing hill cipher algorithm. Here they used different key for each block encryption. Panduranga H.T et.al[4] a hybrid technique for image encryption which employs the concept of carrier image and SCAN patterns generated by SCAN methodology. Although it involves existing method like SCAN methodology. Carrier image is created with the help of alphanumeric key word. Alphanumeric key generated by 4 out of 8-code. Advanced Hill encryption algorithm uses involutory matrix generation method and key matrix is itself invertible. It is the a fast encryption technique with normal hill cipher [5]. Bibhudendra Acharya et.al[6],to repair flaws in the original hill cipher it uses involutory ,permuted and reiterative key matrix. Novel digital image encryption scheme using a secrete key of 144 bits. Here image is divided into blocks and subsequently into colour components. Each colour component is modified by performing bitwise operation which depends on secret key as well as a few most significant bits of its previous and next colour component [7] Encryption method [8] uses cover image which acts as key image for encryption which is shared by both sender and receiver and other. In the first step of encryption XOR the cover image with informative image , and in the next step resultant image is decomposed in to (n*n) blocks which is passed to the hill cipher algorithm to get encrypted blocks. The organization of the paper is as follows: following the introduction, section II explains the concept of Bits Rotation & Reversal technique. Hill Cipher technique is explained in Section III. SHA explained in section IV The proposed method for dual image encryption is explained in section V. Section VI concludes this work and future enhancement. II. So that the weight of each pixel is responsible for its colour, the change occurred in the weight of each pixel of input image due to Bits Rotation & Reversal generates the encrypted image. Hill Cipher Method Hill cipher is an application of linear algebra to cryptography, developed by the mathematician Lester Hill. Image encryption using hill cipher algorithm is derived from the work presented by Bibhudendra Acharya et.al[4,5].Hill cipher algorithm is one of the symmetric key algorithm, it takes n successive plaintext letters and substitutes n cipher text letters. If switch value is ‘0’ hill cipher with invertible matrix is performed, if switch value is ‘1’ hill cipher with non-invertible matrix is performed. III. Bits rotation and Reversal technique for image encryption Here each pixel values of an input image is converted into equivalent eight bit binary number. M bits from the eight bit binary number are rotated to right and reversed. For example, Pin(i,j) is the pixel values of an input image. [B1B2 B3 B5 B6 B7 B8] is equivalent eight bit binary representation of Pin(i,j). IV. Proposed Dual Image Encryption Method The above image encryption method contains three stages. In the first stage Bits Rotation and Reversal operation is applied to both input images. Lower nibbles of corresponding pixels of both resultant images are exchanged in stage two. And in stage three Hill cipher with invertible matrix and Hill cipher with non-invertible matrix operation depending on the switch input value. Fig.1 shows the block diagram of proposed Dual Image Encryption Algorithm. Image1 Switch Hill cipher using Noninvertible matrix Image2 Hill cipher using invertible matrix Decimal to binary i.e. Pin(i,j) . [B1B2 B3 B5 B6 B7 B8] If M=5, five bits of input byte are rotated right to generate resultant byte as [B4 B5 B6 B7 B8 B1 B2 B3]. After rotation, rotated five bits i.e. B4 B5 B6 B7 B8, decimal get reversed as B8 B7 B6 B5Binary B4 toand hence we get the resultant byte as [B8 B7 B6 B5 B4 B1 B2 B3].This resultant byte is converted to equivalent decimal number Pin(i,j). [B8 B7 B6 B5 B4 B1 B2 B3] Bit-wise Rotation by M times Higher nibble of each corresponding pixels of two images are exchanged Encrypted Image1 Encrypted Image2 Pout(i,j) here Pout(i,j) is the output pixel value of resultant image. Fig.1: Block diagram of proposed Dual Image Encryption Image1 Image2 A detail study has been conducted and the results are summarized as followings. Different images have been tested, and similar results are obtained. 1) Histogram of Encrypted Images In order to appear random, the histograms of the encrypted image should be uniform distributed in all gray levels. Fig.3. shows the histograms of original and the encrypted images. It can be observed that a flat histogram is resulted from the encrypted image. Fig.3: Histograms of input and output images. First shows histograms of two input images (Cameraman.tif and lena.gif). Second row shows, histograms of two respective encrypted images. 2) Correlation of Adjacent Pixels Fig.2: Input and Encrypted images. Row 1 consists of two input images, row 2 consists of output of stage 1 and 2, row 3 consists of encrypted image using invertible matrix and row 4 consists of encrypted image using non invertible matrix. v. Results and Discussions In this section, some security analysis of results on the proposed approach are described, including the most important ones like statistical analysis, and differential analysis. A. Statical Analysis In order to resist the statistical attacks, the encrypted images should possess certain random properties. The correlation between two vertically adjacent pixels, two horizontally adjacent pixels in a cipher image can be computed by using the formula Where x and y are gray levels of two adjacent pixels in the image. Fig.6. shows the correlations of two adjacent pixels in the input images and in the respective encrypted images. The correlation coefficients of both images are computed in both horizontal and vertical directions and tabulated in TABLE 1. In Fig.4, correlation of adjacent pixels is represented graphically. TABLE I Image Horizontal 1 Vertical Image Horizontal 2 Vertical Input Image 0.9863 Encrypted Image 0.1419 0.7313 0.8580 0.0150 0.0072 0.7001 0.0018 They are Number of Pixel Change Rate (NPCR)and Unified Average Changing Intensity (UACI).The NPCR is used to measure the number of pixels in difference of gray level in two images. Let C (i, j) and C’ (i, j) be the ith row and jth column pixel of two images C and C’, respectively, the NPCR can be defined as Where N is the total number of pixels in the image and D (i, j) is defined as Another quantity, Unified Average Changing Intensity (UACI) measures the average intensity of differences between the two images. It can be defined as Two quantities, NACP and UACI are calculates for various images using eq. (3) and eq. (4) respectively. The results are tabulated in the TABLE II. TABLE II Fig. 4.Correlation of adjacent pixels of input and encrypted images. Row 1 shows, horizontal & vertical correlation of adjacent Pixels of input image 1. Row 2 shows, horizontal& vertical correlation of adjacent Pixels of input image 2.Row 3 & 4 show, horizontal & vertical correlation of adjacent Pixels of respective encrypted images. 3) Differential analysis The major requirement of all the encryption techniques is the encrypted image should be greatly different from its original form. Two measures are adopted to quantify this requirement. Name of Input Image NPCR UACI Cameraman pandu 99.5987 99.7055 34.4 12.2 Along with Statistical Analysis & Differential Analysis, Mean Square Error (MSE) , Peak Signal to Noise Ratio (PSNR) and Image Entropy for the proposed technique has been computed for different images. We know that, as the MSE increases, PSNR decreases, resulting more randomness in the encrypted image. MSE is calculated using the formula References Where, C (i, j) and C’ (i, j) be the ith row and jth column pixel of two images C and C’, respectively. M and N are number of rows and columns of original image. PSNR can be computed by 2] S.R.M.Prassana et al. “An Image Encryption Method with Magnitude and Phase Manipulation using Carrier Images”. IJCS,2006,Vol.1,no.2,pp.132137. Where R is 255 as we used 8-bit image for experiment. Calculated results of MSE and PSNR are tabulated in TABLE III. TABLE III Name of Input Image MSE Cameraman Lena 105.3766 234.3521 1] Panduranga H T, Naveen kumar S K,”A novel image encryption technique using multi wave based carrier image” 1877-7058 © 2012 Published by Elsevier Ltd. PSNR 8.3628 4.8909 Image Entropy of input and encrypted images are calculated and tabulated in TABLE IV. 3] ISMAIL I.A.1”How to repair the Hill cipher 2006 7(12):2022-2030 4] Panduranga H T, Naveen kumar S K, “Hybrid Approach to Transmit a Secrete Image”, 978-1-42449581-8/11, 2011 IEEE. 5] Bibhudendra Acharya et al. “Image Encryption Using Advanced Hill Cipher Algorithm”. International Journal of Recent Trends in Engineering, Vol.1, No.1, May 2009, pp.663-667. 6] Bibhudendra Acharya et al. “Involutory, Permuted and Reiterative key Matrix generation Methods for TABLE IV Hill Cipher System”. International Journal of Recent Input Image Encrypted Image Trends in Engineering, Vol.1, No.4, May 2009, 7.0097 7.7344 Image 1 pp.106-108 0.9658 7.9736 Image 2 7] Narendra K Pareek, “Design and analysis of a novel Increase of entropy in encrypted images can be digital image encryption scheme”, IJNSA, Vol.4, witnessed from the TABLE IV. This resultant No.2, March 2012, pp.95-108. 104 entropy of encrypted image is almost equal to entropy of a random image which is equal to 8] Ghassan Muslim Hassan ,”Image Encryption Using Permutation and Hill Cipher” eight. VI. Conclusion In this paper we presented an approach for image encryption which has three stages. If we use only Bits Rotation and Reversal only Hill Cipher technique for images with uniform back ground, we can predict original images. But it is difficult predict the original images. The performance of the proposed approach is evaluated based on the Statistical Analysis, Differential Analysis, MSE, PSNR and Image Entropy. We conclude that the encrypted images using combinational approach is more scrambled as compare to individual technique.