You are on page 1of 7

A New Image Encryption Approach Using Block Based Transformation Algorithm

Aditee Gautam1, Dr.P.R Gupta2 Centre for Development of Advanced Computing (CDAC) B-30, Institutional Area, Sector- 62, Noida, India Email ID: gautamaditee@gmail.com, poonamgupta@cdacnoida.in Abstract: Encryption is mainly used to transmit the data over networks. There are so many techniques introduced which are used to protect the confidential image data from any unauthorized access. Multimedia data contains different types of data that includes text, audio, video, graphic, images with the increasing use of multimedia data over internet, here comes a demand of secure multimedia data. Most of the encryption algorithm available is generally used for text data and not suitable for multimedia data. In this paper we discuss a block based transformation algorithm in which image is divided in to number of blocks. These blocks are transformed before going through an encryption process. At the receiver side these blocks are retransformed in to their original position and performed a decryption process which gives the original image. Advantage of this approach, is that it reproduce the original image with no loss of information for the encryption and decryption process we used a blowfish algorithm. Keywords: Image Encryption, Image Correlation, Decryption, Image Entropy, Permutation. 1. INTRODUCTION Encryption is a common technique to uphold image security in storage and transmission of digital images are exchanged over network types. Image encryption has application in various fields include internet communication, multimedia systems, medical imaging and Tele-medicine and military communication. The information security has become more important with the progress in the exchange of data and various encryption systems to encrypt and decrypt image and no single encryption algorithm which is satisfied different types of image. In order to dissipate the high correlation among pixels and increase the entropy value, we have introduced a transformation algorithm that divides the image into blocks and then shuffles their positions before it passes them to the encryption algorithm. In this case that correlation, histograms and entropy has used to measure the security level of the images, advantages of this results in a lower correlation , higher entropy value and a more uniform histogram is compared to using the blowfish encryption algorithm, measures to the security level of the encrypted images. This is similar or different encryption of the variable length secret key is needed in the transformation and encryption process, which is used to build the secret transformation table with a variable number of blocks. If the secret key is changed, another seed will be generated and then the different secret transformation table is obtained. The variable secret key of the Blowfish encryption algorithm is used to encrypt the transformed image. This encryption process can be decreases the mutual information among the encrypted image variables and thus increasing the entropy value. 2. BACKGROUND Image Encryption can become an integral part of the image delivery process if encryption is the process of transforming the information to insure its security with the huge growth of computer networks and the latest advances in digital technologies. As a result, different security techniques have been used to provide the required protection [1]-[2]. Each type of data has its own characteristics include high correlation among pixels, bulk data capacity and high redundancy. Hence, many different techniques should be used to protect confidential image data from unauthorized access. The security level of digital images over network has attracted much attention recently, and many different image encryption methods have been proposed to enhance the security of these images [1]. According to the image encryption scheme try to convert an image to another one that is hard to understand only. On the other side, image decryption retrieves the original image from the encrypted one. We believe that by proposing block based encryption and decryption algorithm, it will reduce to increasing the entropy value of the encrypted images as well as lower correlation. 3. RELATED WORK 3.1 A Technique for image encryption using Digital Signature

In this paper, Aloha Sinha and Kehar Singh [4] have proposed a new technique to encrypt an image for secure image transmission using digital signature of the original image is added to the encoded version of original image, the encoding of the images is done using an error control code. An error control code is determined in real-time on the size of the original image. The digital Signature enables the recipient of a message to authenticate the sender of a message and verify that the message is intact. 3.2 A Lossless Image Encryption Using SCAN Compression and

good at producing higher security level of the image compared to bit permutation. 4. PROPOSED APPROACH A block diagram of the proposed algorithm is shown fig. 1
Original image

Transformation process

Key

In this paper, S.S.Maniccam and N.G. Bourbakis [5] have presented an image encryption using SCAN pattern. The image encryption is performing by SCAN based permutation of pixels and a substitution rule which together form an iterated product cipher, SCAN is a formal language-based two dimensional spatial-accessing methodology which can efficiently specify and generate a wide range of scanning paths or space filling curves, which performs both lossless compression and encryption of binary and gray scale image. 3.3 A new Mirror like Image Encryption Algorithm and its VLSI Architecture In this paper, Jiun-In Guo and Jui-Cheng Yen [6] have proposed an new scheme efficient mirror-like image encryption (MIE) and Visual Cryptography (VC) algorithm based on a binary sequence generated from a chaotic system, an image is scrambled according to these algorithm. This algorithm has possessed low complexity, high security and no distortion. 3.4 A New Chaotic Image Encryption Algorithm In this paper, Jui-Cheng Yen and Jiun-In Guo [7] have proposed a new image encryption scheme based on a chaotic system. It is used to create a binary sequence again. The chaotic image encryption algorithm is used for encryption of text and images. But this algorithm does not have any compression scheme and authenticity verification. 3.5 A New Image Encryption Approach using a combination of permutation techniques In this paper, A.Mitra, Y.V. Subba Rao and S.R.M. Prasanna [3] have proposed a new random combinational image encryption approach with bit, pixel and block permutations. This perceivable information in an image ,it will reduced to decreasing the correlation among the bits, pixels and blocks using certain permutation techniques, whereas the permutation of pixels and blocks are

Encryption process

Cipher image

Figure 1 Proposed Algorithm 5. PROPOSED ALGORITHM The proposed algorithm is divided the image in to it random number of blocks with predefined maximum and minimum number of pixels, resulting in a stronger encryption and a decreased correlation. Overview of the Transformation Algorithm The transformation technique works as follows [1] [2]: where the original image is divided into number of blocks which are shuffled within the image to build a newly transformed image. The generated (or transformed image) is then fed to the blowfish encryption algorithm and thus generated one can be viewed as an arrangement of blocks. This perceivable information can be reduced to decreasing the correlation among the image elements using certain transformation technique. The secret key of this approach is used to determine the seed. The seed plays as role in building the transformation table which is then used to generate the transformed image with different random number of block sizes. In this case, the transformation process refers to the operation of dividing and replacing an arrangement of the original image. Block based encryption and decryption algorithm is based on the combination of image transformation followed by encrypted images and image measurements of correlation, entropy and histograms will be used to measure to the security of the original image, transformed images, encrypted images and decrypted image using the combination technique. The plain image (256-color bitmap) can be decomposed into blocks; each one contains a specific number of pixels (5 pixels x 5pixels blocks) increasing number of block by using

smaller block sizes is resulted in lower correlation and higher entropy. The blocks are transformed into its new locations. For better transformation in the block size should be small, because fewer pixels keep their neighbours. In this correlation will be decreased and thus it becomes difficult to predict the value of any given pixel from the values of its neighbours. At the receiver side, the original image can be obtained by the inverse transformation of the blocks. An Overview of the Encryption Algorithm In general the same key is used for both encrypting and decrypting is grouped using private key technique while there are two different asymmetric key techniques: public key for encryption and private key for decryption. This transformation process should be conducted by a user providing secret key and the decryption process is the inverse transformation to the cipher text using the same key. Blowfish encryption algorithm is a symmetric block cipher that can be effectively used for encryption and safeguarand of data just like DES or IDEA. The blowfish encryption algorithm has been analysed considerably and is gaining acceptance as a existing encryption algorithm. The block size is 64 bits blocks and key can be any length up to 448 bits before encrypting them. It takes a variable length key from 32 to 448 bits; All operations are XORs and additions on 32 bits words [16] and making it ideal for both domestic and exportable use. In this algorithm is the part of system has to generate key, through any key generating algorithm. Bitmap Image Encryption Bitmap file is a type of uncompressed image format all information about the image data store in it. 1. In the encryption process, data image as a plaintext and the encryption key are two inputs of encryption process. In this case, original image data bit stream is divided into the blocks length of Blowfish algorithm. Image header is excluded to encrypt and the start of the bitmap pixel or array begins right after the header of the file. The byte elements of the array are stored in row order from left to right with each row representing one scan line of the image and the rows of the image are encrypted from top to bottom.
Encryption key Original Image Encrypted Image Blowfish

encryption key is used to decrypt the image but the application of sub keys is reversed. The process of decryption is continued with other blocks of the image from top to bottom.
Decryption key Encrypted Image Original Decrypted Image

Blowfish

This sender and receiver side has to do following steps: 5.1 At the Sender Side Convert given image into blocks of n x n Encrypt image each pixel using their position (x, y). Encrypt image each block using the encryption key. Calculate the entropy and correlation for security level of the image analysis. It is Transfer the Image. Algorithm Encrypt_Image Image (image, n, pub_rec) 1: Load the plain Image (i.e. Original image) 2: calculate the Width and Height of the input image 2.1: Lower Horizontal Number of Blocks = Integer (Image_Width / n) 2.2: Lower Vertical Number of Blocks = Integer (Image_Height /n) 3: No.of Blocks = HorizontalNumber of Blocks VerticalNumber of Blocks 4: For n = 0 to No.ofBlocks -1 4.1: for x=0 to n-1 4.2: for y=0 to n-1 4.3: Encrypt image each pixel using their position (x, y), end Perform_Encryption by pixel using their position Perform_Encryption by Number of block Input: Image blocks, Receiver public key for encryption. 5: For n = 0 to No.of Blocks 1 5.1: Encrypt image each block with the key of receiver, 6: Calculate correlation and entropy of this original image and encrypted image Output: Encrypted image with decreased correlation and increased entropy value. Algorithm Perform_Transformation 1: for i=0 to No.ofBlocks-1 1.1: Get the new location of block i from the transformation table 1.2: Set blocks i in its new location. END

2. In the decryption process, the encrypted image is divided into the same block length of Blowfish algorithm from top to bottom. The first block is entered to the decryption function and the same

Perform_Transformation table Input: Original Image (BMP Transformation table. Output: Transformed Image. 5.2 At the Receiver Side

image)

and

(g)

(h)

(i)

Divide the received Image in n x n blocks by sender Decrypt image each block using the decryption key. Decrypt image each pixel using its position (x, y). Decrypted Image is the original. Algorithm Decrypt_Image Image (image, n, pub_rec,) 1: Load the plain Image (i.e. Original Image) 2: calculate the Width and Height of the image 3.1: Lower Horizontal Number of Blocks = Integer (Image_Width / n) 3.2: Lower Vertical Number of Blocks = Integer (Image _Height/n) 4: No.of Blocks = HorizontalNumber of Blocks VerticalNumber of Blocks 5: For n = 0 to No.of Blocks -1 5.1 Decrypt image each block with the key of receiver, end Perform_Encryption by pixels using their position Perform_Encryption by Number of block Input: Image blocks, Receiver private key for decryption. 6: For n = 0 to No.of Blocks 1 6.1: for x=0 to n-1 6.2: for y=0 to n-1 6.3 decrypt image each pixel using their position (x, y) 6. EXPERIMENTAL RESULTS

Figure 2 Frame (a), (d) and (g) Color image respectively show the Original image of Lena, Om and Airplane. Frame (b), (e) and (h) respectively show the Encrypted image (i.e. cipher image). Frame (c), (f) and (i) respectively show the Decrypted Image.

(j)

(l)

(m)

Figure 3: Frame (j) Gray Image show the original Image of lena. (l) Show the Encrypted image. (m) Decrypted image.

Difference between Original image fig 2(a) and Decrypted Image fig 2(c) is shown fig.4. so, there is no loss of information if difference is always 0.

Figure 4 Difference Image (No loss of information)

This algorithm is applied on a bit mapped (bmp) image that has the size of 300 pixels x 300 pixels with 256 colors. In order to test the impact of the number of blocks on the correlation and entropy, three different cases are tested. The number of blocks and the block sizes for each case are shown in Table 1. Table 1: the Number of Blocks on the Correlation and Entropy Case Number 1 Number of Block 30 x 30 60 x 60 100 x 100 Block Size 10 pixels x 10 pixels 5 pixels x 5 pixels 3 pixels x 3 pixels

(a)

(b)

(c)

2 3

(d)

(e)

(f) (a) (b) (c)

(d)
Figure 5 Result of encryption by using block size. (a) Original image. (b) Transformed image using 10 pixel x 10 pixels. (c) Transformed image using 5 pixels x 5 pixels. (d) Transformed image using 3 pixels x 3 pixels.

(c)

(d)

Figure 6: (a) Original Image (b) Histograms of Original Image (c) Encrypted Image (d) Histograms of Encrypted Image

7. SECURITY ANALYSIS A good encryption procedure should be robust against all kinds of cryptanalytic, brute-force and statistical attacks. In this case, the performance of the proposed algorithm is analyzed. 7.1 Key Space Analysis For secure image encryption, the key space should be large enough to make the brute force attack infeasible. The proposed algorithm has 2256 different combinations of the secret key. An image cipher with such as a long key space is sufficient for reliable practical use [11]. Furthermore, if we consider the two seed points of shuffler as part of the key; the key space size will be even larger. Hence, the key space of the proposed algorithm is extensively large enough to resist the exhaustive of brute-force attacks. 7.2 Histogram Analysis In the experiments, the original image and its corresponding encrypted image and their histograms of red, blue and green channels are shown in fig 6. It is clear that the histogram of the encrypted image is nearly uniformly distributed, and significantly different from the respective histograms of the original image. So, the encrypted image does not provide any clue to employ any statistical attack on the proposed encryption of an image procedure, which makes statistical attacks difficult. These properties tell that the proposed image encryption has high security against statistical attacks. In the original image (i.e. plain image), some gray-scale values in the range [0, 255] are still not existed, but every gray-scale values in the range [0, 255] are existed and uniformly distributed in the encrypted image. Some gray-scale values are still not existed in the encrypted image although the existed gray-scale values are uniformly distributed. Different images have been tested by the proposed image encryption procedure.

(a)

(b)

Figure 6(a): (a) show the histograms of red, green and blue channels of the original image (b) show the histograms of red, green and blue channels of the encrypted image.

7.3 Correlation of Two adjacent Pixels Correlation is a measure of the relationship between two variables if the two variables are the original image and their encryptions then they are in prefect in correlation. In this case the encrypted image is the same as the original image and the encryption process failed in hiding the details of the original image. There is a very good correlation between adjacent pixels in the image data. Then, calculate their correlation coefficient using the following two formulas[12]: Cr= N j-1N (xjyj) - j-1N xj X j-1N yj
(1)

[N j-1N xj2 (j-1N xj) 2][N j-1N yj2 (j-1N yi)2 ] Where x and y are gray values of two adjacent pixels in the original and encrypted image and N is the total number of adjacent pixels selected from the image. We randomly select 5000 pairs of two adjacent pixels. If the correlation coefficient equals zero, then the original image and its encryption are totally different i.e. the encryption image has no features and highly independent on the original image. If the correlation coefficient equal -1, this means encrypted image is a negative of the original image. Figure 7 shows the distribution of two adjacent pixels in the original image and encryptedimage. It is observed that adjacent pixels in the original image (i.e. plain-image) are correlated too much, while there is a small correlation between adjacent pixels in the encrypted image. Result for correlation coefficients of two adjacent pixels is shown in Table 2 and Table 3.

(a)

(b)

Table 2: Correlation of Two adjacent pixels


Adjacent Pixels Orientation Horizontal Vertical Plain Image 0.9883 0.9958 Cipher Image 0.0045 -0.0188

information entropy that is the ciphered image should not provide any information about the plain image. The information entropy is calculated using equation (2) He = -k=0 G-1 P (k). log2 (P (k)) (2)

Where: He= Entropy of image G = Gray value of an input image (0-255). P (k) = Probability of the occurrence of symbol k If each symbol has an equal probability then entropy He= 8 which corresponds to some random source. Table 4: Image Entropy
Image Number of Block Entropy Value

(a)

(b)

Original Image fig 2(a) (c) (d) Encrypted Image fig2(b)

Figure 7: Correlation of two adjacent pixels: (a) distribution of two horizontally adjacent pixels in the original image, (b) distribution of two horizontally adjacent pixels in the encryptedimage(i.e. cipher image), (c)distribution of two vertically adjacent pixels in the original image, (d) distribution of two vertically adjacent pixels in the cipher-image.

30 x 30 60 x 60 100 x 100 300 x 300 30 x 30 60 x 60 100 x 100 300 x 300

7.5875 7.6807 7.7173 7.7565 7.9313 7.9817 7.9939 7.9994

Table 3: Correlation coefficient of two adjacent pixels in the proposed method Correlation coefficient Analysis Adjacent pixels orientation Image
Number of Block

Horizontal 0.3221 0.8790 0.9661 0.9706

Vertical 0.6861 0.9966 0.9518 0.9887

Original Image(plain Image) Fig 2(a)

30 x 30 60 x 60 100 x 100 300 x 300

Encrypted Image (Cipher Image) Fig 2(b)

30 x 30 60 x 60 100 x 100 300 x 300

0.2503 -0.1846 0.0548 0.0050

0.1554 -0.3537 0.0433 -0.0619

7.5 Time Analysis In this work, all programs applied in simulating the encryption algorithms, the security analysis, and an efficient measuring methods used to produce the values of comparison criteria are designed by Borland Delphi 5.0 and MATLAB 7.4 under Microsoft windows XP Professional Version 2002 Service Pack 2 on, Intel(R) Pentium(R) CPU 1.73GHz, 504 MB of RAM, and 80 GB hard-disk capacity (Laptop computer). We also do the time analysis on it, but not ideal. The keysteam generation system consumes longer time. The test is applied on two selected bitmap images; each image is 512 512 pixels in size. The main interest lies in the 24 bit uncompressed RGB color mode, and 8 bits per pixel (bpp), or 256 intensity levels. Table 5: Time of Proposed algorithm (in Seconds)
Image (in BMP)
Lena

Size (in Pixels)


256 x 256 300 x 300 512 x 512 256 x 256

Type

Elapsed Time(in Seconds)


0.0396 sec 0.0255 sec 0.0733 sec 0.0397 sec

Encryption Time (in Seconds)


0.0906 sec

Decryption Time (In Seconds)


0.0889 sec

Color

7.4. Image Entropy It is well known that entropy is measures the uncertainty association with random variable. As for grayscale image in Block Based Image Encryption decreases the mutual information among encrypted image variables (i.e. high contrast) and thus increases the entropy value. A secure cryptosystem should fulfil a condition on the
Lena

Gray

0.1389 sec

0.1372 sec

Om

Color

0.2443 sec

0.2407 sec

Airplane

Color

0.0907 sec

0.0927 sec

8. Conclusion In this paper, proposed algorithm the images has improved for image security using a combination of image transformation and encryption techniques. The cases showed that the correlation is decreased when the proposed algorithm is applied to them before the encryption algorithm. Experimental results of the proposed technique showed that an inverse relationship exists between number of blocks and correlation, a direct relationship between number of blocks and entropy. The proposed algorithm will expect in the best performance; the lowest correlation and the highest entropy. References [1] M. A. Bani Younes and Aman Jantan, Image Encryption Using Block-Based Transformation AlgorithmIAENG, 35:1, IJCS_35_1_03, February 2008. [2] Kamlesh Gupta and Sanjay Silakari A Choase Based Image Encryption Using Block-Based Transformation Algorithm IJCNS, Dec 2009. [3] A. Mitra, Y V. Subba Rao, and S. R. M. Prasnna, "A new image encryption approach using combinational permutation techniques," Journal of computer Science, vol.1, no. 1, 2006, p.127, http://www.enformatika.org [4] Aloha Sinha, Kehar Singh, A technique for image encryption using digital signature, Optics communications, ARTICLE IN PRESS, 2003, 1-6, www.elsevier.com/locate/optcom [5] S.S.Maniccam, N.G. Bourbakis, A Lossless image compression and encryption using SCAN, Pattern Recognition 34 (2001), 1229-1245 [6] Jiun-In Guo, Jui-Cheng Yen, A new mirrorlike image Encryption algorithm and its VLSI architecture, Department of Electronics Engineering National Lien-Ho College of Technology and Commerce, Miaoli, Taiwan, Republic of China [7] Jui-Cheng Yen, Jiun-In Guo, A new chaotic image encryption algorithm Department of Electronics Engineering National Lien-Ho College of Technology and Commerce, Miaoli, Taiwan, Republic of China. [8]I. Ozturk, I.Sogukpinar, "Analysis and comparison of image encryption algorithm," Journal of transactions on engineering, computing and technology, December, http://www.enformatika.org/.

[9]Guosheng Gu, An Enhanced Chaos Based Image Encryption Algorithm, School of Computer Science and Engineering, South China University of Technology, Proceedings of the First International Conference on Innovative Computing, Information and Control (ICICIC'06) 2006 IEEE [10] Syed Ali Naqi Gilani, M. Ajmal Bangash, Enhanced Block Based Color Image Encryption Technique with Confusion, GIK Institute of Engineering Sciences and Technology, Proceedings of the 12th IEEE International Multitopic Conference, December 23-24, 2008 [11] Shubo Liu, Jing Sun, Zhengquan Xu, An Improved Image Encryption Algorithm based on Chaotic System JOURNAL OF COMPUTERS, NOVEMBER 2009. [12] Alireza Jolfaei, Abdolrasoul Mirghadri, An Image Encryption approach using Chaos and Stream cipher, Journal of Theoretical and Applied Information Technology, 2005-2010. [13] Zhang Jun, Li JinPing,Wang Luqian, A New Compound Chaos Encryption Algorithm for Digital Images, 2010 International forum on Information Technology and Applications. [14] Monisha Sharma and Manoj kumar kowar, Image Encryption Technique using chaotic schemes: A review, IJEST, 2010. [15] Mohammad Ali Bani Younes and Aman Jantan, An Image Encryption Approach Using a Combination of Permutation Technique Followed by Encryption IJCSNS, April 2008 [16]Blowfish, 12 December 2007, http://en.wikipedia.org/wiki/Blowfish_%28cipher% 29. Bibliography [1] c. Ratael, Gonzales, e. Richard, and woods, "Digital image processing," 2nd Ed, Prentice hall, 2002.

You might also like