Sunteți pe pagina 1din 12

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No.

6 ISSN: 1837-7823

Cryptography of a Gray Level Image and a Color image Using Generalized Hill Cipher Involving Multiple Keys, Mixing and Key Dependent Substitution
V. U. K. Sastry1 and Ch. Samson2
1

Dept. of Computer Science & Engineering., SNIST, Hyderabad, India, vuksastry@rediffmail.com


2

Dept. of Information Technology, SNIST, Hyderabad, India, samchepuri@gmail.com

Abstract
In this paper we have used the Generalized Hill Cipher Involving multiple Keys, Mixing and Key dependent substitution for the encryption of an image. Firstly we have developed a procedure for the encryption of a gray level image and then extended this analysis to a color image by representing it in terms of RGB model. The functions Mixing and key dependent substitution which are occurring in the development of the cipher are offering a strong conversion of the image from one form to the other and hence the encrypted form of the image has achieved high security. Keywords: Encryption, Decryption, Gray level image, Color image, RGB model, Generalized Hill cipher, Mixing, Substitution

1. Introduction
The conversion of an image from one form to another so that the original image cannot be deciphered in the process of transmission, from one place to another place, is a fascinating area of research. In the light of this fact, in recent years, the blending of cryptography and image processing has led to the development of a novel branch of image processing called Image Cryptography. Several authors have devoted their attention to the study of the cryptography of gray level images [1-7] and the cryptography of color images [8-12] in recent years. Of late, in one of our investigations[13], we have studied the cryptography of a gray level image by using generalized Hill cipher involving powers of a single key matrix and a set of functions called Mix( ) and Substitute( ), used for strengthening the cipher. In the present paper, our objective is to study the cryptography of a gray level image and the cryptography of a color image, wherein we use RGB model [14]. In this we use the block cipher entitled generalized Hill cipher [15] involving multiple keys, and the functions mixing and key dependent substitution, denoted by Mix( ) and Substitute( ), which we have developed in the recent past. Here our interest is to see how a gray level image and a color image undergo transformation when we apply the encryption process of the block cipher. In what follows we present the plan of the paper. In section 2, we discuss the development of a procedure for the cryptography of an image. In section 3, we illustrate the cryptography of an image. Then in section 4, we present the encryption of a gray level image. In section 5, we deal with the encryption of a color image. Finally in section 6, we draw conclusions obtained from this analysis.

2. Development of a procedure for the cryptography of an image


Let us consider a gray level image G which is represented in the form of a matrix given by G = [Gij], i=1 to 256 and j= 1 to 256. (2.1)

We take a set of key matrices, Ki, i=1 to 16, wherein each matrix is a square matrix of size 4. We now focus our 40

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 attention on a portion of the image G, let us call this as P, where P = [Pij], decomposing P into 16 matrices, we can write P1 P5 P= P9 P2 P6 P10 P3 P7 P4 P8 (2.2) i=1 to 16 and j= 1 to 16. On

P11 P12 P15 P16

P13 P14

where each one of the Pi, i= 1 to 16, is a square matrix of size 4. Here we have P1=[Pij], i=1 to 4, j= 1 to 4;P2= [Pij], i=1 to 4, j= 5 to 8, P3= [Pij], i=1 to 4, j= 9 to 12;P4=[Pij], i=1 to 4, j= 13to 16, P5=[Pij], i=5 to 8, j= 1 to 4; P6= [Pij], i=5 to 8, j= 5 to 8,P7= [Pij], i=5 to 8, j= 9 to 12;P8=[Pij], i=5 to 8, j= 13to 16, P9=[Pij],i=9 to12,j= 1 to 4; P10=[Pij], i=9to12,j=5 to 8,P11=[Pij],i=9 to12,j= 9 to 12;P12=[Pij], i=9 to 12, j= 13 to 16, P13=[Pij], i=13 to 16,j=1to4;P14=[Pij], i=13to16,j=5to 8,P15=[Pij],i=13to16, j=9 to12;P16=[Pij],i=13 to16,j=13to 16.

41

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 On using the basic idea of the Hill cipher [1], we get Ci= (Ki Pi) mod N, i=1 to 16, (2.3)

where Ci, are the ciphertext matrices corresponding to the plaintext matrices Pi. The flowcharts for encryption and decryption in the generalized Hill cipher involving multiple keys, mixing and key dependent substitution are given below. Read P, s, r, N for i = 1 to s Read Ki end Construct NT and ST Read C, s, r, N for i = 1 to s Read Ki end for i = 1 to s Compute Ki-1 for i= 1 to r end Construct NT and ST

Pi =Decompose (P)

for i= 1 to r for i = 1 to s Pi= (Ki* Pi) mod N end P = Compose (Pi) P = Mix (P) C= Imix (C) C=Isubstitute (C,NT,ST)

Ci=Decompose(C) for i = 1 to s Ci= (Ki-1* Ci) mod N end

P=Substitute (P,NT,ST)

C= P C = Compose (Ci) Write C P=C

Write P (a) Process of Encryption (b) Process of Decryption

Figure 1: Schematic diagram of the cipher

42

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 The algorithms corresponding to the flow charts are presented here. Algorithm for Encryption 1. Read P, s, r, N 2. for i = 1 to s Read Ki end 3. Construct NT and ST 4. for i = 1 to r Pi =Decompose (P) for i = 1 to s Pi= (Ki* Pi) mod N end P = Compose (Pi) P= Mix(P) P=Substitute (P,NT,ST) end 5. C = P 6. Write C Algorithm for Decryption 1. 2. Read P,s, r, N for i = 1 to s Read Ki End 3. for i = 1 to s Compute Ki-1 End 4. Construct NT and ST 5. for i = 1 to r C=Isubstitute (C, NT, ST) C= Imix (C) Ci=Decompose(C) for i = 1 to s Ci= (Ki-1* Ci) mod N end C = Compose (Ci) end 6. P = C 7. Write P 43

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 In the flowcharts and algorithms, NT is a table having 16 rows and 16 columns containing the elements [0 255] in a row wise order, and ST is the substitution table. Here r denotes the number of rounds in the iteration process and s is the number of key matrices and the number of portions of the plaintext. N=256 as we confine our attention to EBCDIC code. In this analysis, we take r=16 and s=16. For a detailed discussion of NT, ST, and the functions Decompose ( ), Mix ( ), Substitute( ),Compose( ), Imix( ) and Isubstitute( ), we may refer to [13].

3. Illustration of the cryptography of an image


Let us now consider the following gray level image.

Figure 2: Image of Lena We now represent this image G in terms of pixel values and obtain a matrix of the form (3.1) G = [Gij], i=1 to 256 and j= 1 to 256, wherein each gray level value is in [0,255]. Before we proceed to the encryption of the entire image, in order to have a clear insight into the process of encryption, let us consider a small portion of the image which lies in between the rows 113 and 128, and columns 113 and 128. This typical portion is selected as it is depicting a portion of an eye of the image. This part of the image can be written in the form of a matrix given by (3.2) P = [Pij], i=1 to 16 and j= 1 to 16. Thus we have

44

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

Let us now consider the key matrices denoted by Ki, i=1 to 16, used in the development of the cipher [ 15 ]. Here we have written all the 16 matrices by a single matrix given by

In this matrix, we have Ki, i=1 to 4, in the first four rows, Ki, i=5 to 8, in the next four rows of K. The rest of the matrices Ki, i=9 to 12 and Ki, i=13 to 16 are in the subsequent rows. We have placed all the 16 matrices in a single matrix as this representation is convenient. The modular arithmetic inverses of the 16 matrices are presented in a single matrix given below. Of course, the correspondence is thoroughly maintained in this representation.

45

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

On applying the encryption algorithm, given in section 2, we obtain the ciphertext C corresponding to the plaintext P, given by (3.3), in the form

On using the decryption algorithm, we have got back the plaintext (3.3) corresponding to the input image for a check up.

46

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

4. Encryption of a gray level image


Let us now consider the entire gray level image G presented at the beginning of section 3. The gray level values corresponding to this image are in the form of a square matrix of size 256. This matrix can be conveniently decomposed into 256 square matrices wherein each matrix is of size 16. On applying the encryption procedure, illustrated in section 3, on each one of the 256 matrices, corresponding to the entire gray level image, we get the encrypted image of the gray level image. This is shown in Figure 3.

Figure 3 Encrypted image of Lena From this analysis, it is worth noticing that this gray level image is totally different from the original image . This shows that any gray level image can be concealed in a conspicuous manner by applying the encryption process. The programs for encryption and decryption are written in MATLAB.

5. Encryption of a color image


Let us now consider the color image given below.

Figure 4: Input color image of a baby 47

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 On using the RGB color model in image processing [14], we get the following 3 components corresponding to the colors red, green and blue as shown below.

Figure 4(a): Red component of the input image

Figure 4(b): Green component of the input image

48

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

Figure 4(c): Blue component of the input image It may be noted here that each one of these component images can be considered as gray level images and hence the gray level value of each pixel in these component images will be lying in the interval [0 255]. Thus on adopting the encryption process, discussed in section 4, for each component image separately, we get the encrypted image of each component. On combining the encrypted forms of these component images, we get the encrypted form of the color image which is shown below.

Figure 5: Encrypted form of the color image This transformation from the original color image (Figure 4) to the encrypted color image (Figure 5) is a remarkable one.

6. Conclusions
In this investigation, we have developed a procedure for the encryption of a gray level image by using a block cipher called generalized Hill cipher involving multiple keys, mixing and key dependent substitution. On using this procedure, we have obtained the encrypted form of a gray level image. Then on using RGB model which 49

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 leads to three color component images of a color image, we have encrypted the color image which has yielded a secured form of the image. It may be noted here that the conversion of an image from one form to another is a very useful one in hiding the information and hence ensures security.

References
[1] Hossam El-din H. Ahmed, Hamdy M. Kalash, and Osama S. Farag Allah, Encryption Efficiency Analysis and Security Evaluation of RC6 Block Cipher for Digital Images, International Journal of Computer, Information, and Systems Science, and Engineering, Vol. 1, No. 1, pp. 33 39, 2007. [2] M. Zeghid, M. Machhout, L. Khriji, A. Baganne, and R. Tourki, A Modified AES Based Algorithm for Image Encryption, World Academy of Science, Engineering and Technology, Vol. 27, pp. 206 211, 2007. [3] Bibhudendra Acharya, Saroj Kumar Panigrahy, Sarat Kumar Patra, and Ganapati Panda, Image Encryption Using Advanced Hill Cipher Algorithm, International Journal of Recent Trends in Engineering, Vol. 1, No. 1, May 2009. [4] Dr. V. U. K. Sastry, Prof. D. S. R. Murthy, Dr. S. Durga Bhavani, Cryptography of a Gray Level Image Using a Modified Feistel Cipher, International Journal of Advanced Research in Computer Science (IJARCS), Vol. 1, No. 3, Sep. Oct 2010. [5] Dr. V. U. K. Sastry, Prof. D. S. R. Murthy, Dr. S. Durga Bhavani, Cryptography of a Gray Level Image Using a Novel Block Cipher Involving Feistel Structure and Modular Arithmetic, International Journal of Advanced Research in Computer Science (IJARCS), Vol. 1, No. 3, Sep. Oct 2010. [6] Dr. V. U. K. Sastry, Prof. D. S. R. Murthy, Dr. S. Durga Bhavani, Cryptography of a Binary Image Using Modified Hill Cipher, International Journal of Computer and Network Security (IJCNS), Vol. 2, No. 6, June 2010. [7] Dr. V. U. K. Sastry, Prof. D. S. R. Murthy, Dr. S. Durga Bhavani, Cryptography of a Gray Level Image Using Modified Hill Cipher, International Journal of Computer and Network Security (IJCNS). Vol. 2, No. 6, June 2010. [8] Rodrigues, J.M. Puech, W. Bors, A.G. "Selective Encryption of Human Skin in JPEG Images", IEEE International Conference on Image Processing, 2006. [9] Puech, W.; Rodrigues, J.M.; Bors, A.G.,"Analysis and Cryptanalysis of a Selective Encryption Method for JPEG Images", Eighth International Workshop on Image Analysis for Multimedia Interactive Services, 2007. WIAMIS07, June 2007. [10] L. Tang. Methods for Encrypting and Decrypting MPEG Video Data Efficiently. In Proc. ACM Multimedia, volume 3, pages 219229, 1996. [11] R. Lukac and K. Plataniotis. Bit-Level Based Secret Sharing for Image Encryption. Pattern Recognition, 38(5):767772, May 2005. [12] Chin-Chen Chang, Min-Shian Hwang, Tung-Shou Chen, A new encription algorithm for image cryptosystems, The Journal of Systems and Software 58 (2001), 83-91 50

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 [13] V. U. K. Sastry, Ch.Samson, cryptography of a gray level image by using generalized Hill cipher involving Powers of a single key, Mixing and Substitution, International Journal of Advanced Research in Computer Science, May-June 2012(Sent for publication). [14] Rafael C. Gonzalez & Richard E. Woods, Digital Image processing, 2ndEdition Pearson Education 2004. [15] V. U. K. Sastry, Ch.Samson,Generalized Hill Cipher Involving Multiple Keys, Mixing and Key Dependent Substitution, International Journal of Computational Intelligence and Information Security , June-July, 2012(Sent for publication).

Dr. V. U. K. Sastry is presently working as Professor in the Dept. of Computer Science and Engineering (CSE), Director (SCSI), Dean (R & D), SreeNidhi Institute of Science and Technology (SNIST), Hyderabad, India. He was Formerly Professor in IIT, Kharagpur, India and worked in IIT, Kharagpur during 1963 1998. He guided 12 PhDs, and published more than 70 research papers in various international journals. He received the best Engineering College Faculty Award in Computer Science and Engineering for the year 2008 from the Indian Society for Technical Education (AP Chapter) and Cognizant- Sreenidhi Best faculty award for the year 2012. His research interests are Network Security & Cryptography, Image Processing, Data Mining and Genetic Algorithms.

Mr. Ch. Samson obtained his Diploma from Govt Polytechnic, Hyderabad in 1994, B. E. from Osmania University in 1998 and M. E from SRTM University in 2000. Presently he is pursuing Ph.D. from JNTUH, Hyderabad since 2009. He published 9 research papers in international journals and two papers in conferences. He is currently working as Associate Professor and Associate Head in the Dept. of Information Technology (IT), SNIST since June 2005. His research interests are Image Processing, Image Cryptography and Network Security.

51

S-ar putea să vă placă și