K n secret sharing visual cryptography scheme for color image using random number.bak


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

K n secret sharing visual cryptography scheme for color image using random number.bak

  1. 1. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST) K-N SECRET SHARING VISUAL CRYPTOGRAPHY SCHEME FOR COLOR IMAGE USING RANDOM NUMBER SHYAMALENDU KANDAR 1, 1, Haldia Institute of Technology, Haldia, India ARNAB MAITI2 1, Haldia Institute of Technology, Haldia, India Abstract:Visual Cryptography is a special encryption technique to hide information in images in such a way that itcan be decrypted by the human visual system. The benefit of the visual secret sharing scheme is in itsdecryption process where without any complex cryptographic computation encrypted data is decryptedusing Human Visual System (HVS). But the encryption technique needs cryptographic computation todivide the image into a number of parts let n. k-n secret sharing scheme is a special type of VisualCryptographic technique where at least a group of k shares out of n shares reveals the secretinformation, less of it will reveal no information.In our paper we have proposed a new k-n secret sharing scheme for color image where encryption(Division) of the image is done using Random Number generator. http://ieeexploreprojects.blogspot.comKeywords: Visual Cryptography, Secret Sharing, Random Number. 1. IntroductionVisual cryptography is a cryptographic technique which allows visual information (Image, text, etc) to beencrypted in such a way that the decryption can be performed by the human visual system without the aid ofcomputers.[1]Image is a multimedia component sensed by human. The smallest element of a digital image is pixel. In a 32 bitdigital image each pixel consists of 32 bits, which is divided into four parts, namely Alpha, Red, Green andBlue; each with 8 bits. Alpha part represents degree of transparency. If all bits of Alpha part are ‘0’, then theimage is fully transparent. This is represented in the following figure. [2] [3] 11100111 11011001 11111101 00111110 Alpha Red Green Blue Figure 1: Structure of a 32 bit pixelHuman visual system acts as an OR function. If two transparent objects are stacked together, the final stack ofobjects will be transparent. But if any of them is non-transparent, then the final stack of objects will be non-transparent. Like OR, 0 OR 0 = 0, considering 0 as transparent and 1 OR 0=1, 0 OR 1 =1, 1 OR 1=1,considering 1 as non-transparent.ISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1851
  2. 2. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST) Share1 Share 2 Final          Transparent (0) Non-Transparenr(1) Figure 2: Human Visual system as OR FunctionIn k out of n visual cryptography scheme is a type of cryptographic technique where a digital image is dividedinto n number of shares by cryptographic computation.[4] In the decryption process only k or more than k http://ieeexploreprojects.blogspot.comnumber of shares can reveal the original information [Here can form the original image]. Less than k number ofshares can not reveal the original information. [5] [6]In this paper we have proposed an algorithm to divide a digital color image into n number of shares whereminimum k numbers of shares are sufficient to reconstruct the image. If k numbers of shares are taken then theremaining shares are (n−k). In an image if certain position of a pixel is 1, then in (n−k)+1 number of shares inthat position of that pixel there will be 1. In the remaining shares in that position of the pixel there will be 0. Arandom number generator is used to identify those (n−k)+1 number of shares.In this paper Section II describes the encryption algorithm, Section III describes decryption algorithm, SectionIV describes the experimental result, Section V describes the future scope and Section VI draws the conclusion.2. Encryption AlgorithmAn image is taken as input. The number of shares the image would be divided (n) and number of shares toreconstruct the image (k) is also taken as input from user. The encryption, i.e. division of the image into nnumber of shares such that k numbers of shares are sufficient to reconstruct the image; is done by the followingalgorithm.Step: I: Take an image as input and calculate its width (w) and height (h).Step II: Take the number of shares (n) and minimum number of shares (k) to be taken to reconstruct the image.k must be less than or equal to n.Step III: Calculate recons=(n-k)+1.Step IV: Create a three dimensional array img_share[n][w*h][32] to store the pixels of n number of shares.ISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1852
  3. 3. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST)Step V:for i=0 to (w*h-1){ Scan each pixel value of the image and convert it into 32 bit binary string let PIX. for j=0 to 31 { if ith position of PIX contains ‘1’ call Random_Place(n, recons)for k=0 to (recons-1) { Set img_share[rand[k]][i][j] = 1 } }}Step VI: Create a one dimensional array img_cons[n] to store constructed pixels of each share.Step VII:for k1=0 to(n-1){ for k2=0 to (w*h-1) { String value= “” for k3=0 to 31 { value=value+img_share[k1][k2][k3] }construct alpha, red, green and blue part of each pixel by taking consecutive 8 bit substring starting from 0.Construct pixel from these part and store it into img_cons[k1].1 [7] } generate image from img_cons[k1].3 [8]} http://ieeexploreprojects.blogspot.comsubroutine int Random_Place(n,recons){ create an array rand[recons] to store the random number generated. for i=0 to (recons-1) { generate a random number within n, let rand_int.2 [9] if(rand_int is not in rand[recons]) rand[i] = rand_int. } return rand[recons]}3. Decryption AlgorithmIn the case of visual cryptography, decryption is done by human visual system. It is already discussed thathuman visual system acts as an OR function. In the case of decryption, for computer generated program; ORfunction can be used.Here the numbers of shares are taken as input from user. As the shares are created from the image taken as inputin encryption algorithm, each share must be of equal height and width as the source image. Then bitwise ORoperation is performed among pixels of the shares, and final pixel values are stored in an array.The decryption algorithm is as follows.Step I: Input number of shares to be taken (k), height (h) and width (w) of each share.Step II: Create a two dimensional array share[k][w*h] to store the pixel values of each share.Create a one dimensional array final[w*h] to store the final pixel values of the image to be produced byperforming OR operation.Step III:for i=0 to k-1ISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1853
  4. 4. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST){ input the name of the ith image share to be taken. for j=0 to (w*h-1) { Scan each pixel value of the ith image share and store the value in share[i][j]. }}Step IV:for i=0 to (k-1) { for j=0 to (w*h - 1) { final[j]=final[j] | share[i][j]; [ | is bitwise OR] }}Step V: Generate image from final[w*h].3 [8]4. Experimental ResultEncryption Process:Source Image: Lena.pngSource image is http://ieeexploreprojects.blogspot.com Figure 3: Source ImageNumber of Shares: 6Numbers of shares to be taken: 5The experimental result after encryption by the encryption algorithm is given below. 0img.png 1img.png 2img.pngISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1854
  5. 5. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST) 3img.png 4.img.png 5img.png Figure 4: Encrypted SharesDecryption Process:Number of shares: 5Height and Width of each share: 200, 200Shares inputted0img.png, 1img.png, 3img.png, 4img.png, 5img.pngFinal image reconstructed: Figure 5: Reconstructed Image http://ieeexploreprojects.blogspot.comIf three shares let 0img.png, 2img.png, 5img.png are taken, the decrypted image become Figure 6: Reconstructed Image with less than k number of sharesThe image is a distorted image and conveys partial information about all pixels. If some text is hidden within theimage by invisible digital watermarking, then original image is required to get that watermarked text. [10]5. Future ScopeVisual cryptography technique is used to make the data secure. Here the original data is divided into a numberof shares which are sent through different communication channels from sender to receiver. Therefore theintruder has less chance to get the whole information. But still it is not so secured. This can be made moresecure by introducing a symmetric key for both encryption and decryption process. [11]Using the key, the image is first encrypted then divided into a number of shares. If the intruder gets k number ofshares s/he can not be able to decrypt it if the key is not known to his/her. For key, a combination of character ornumber can be used. The change of higher bits make the image more blur, so the key can be applied on thehigher bits of each pixels.A small image can also be used as a key. Let an image with size w1 X h1 is taken as a key where w1<w andh1<h. The original image is divided into blocks of w1 X h1. For each block, (w1, h1) th pixel is encoded with(w1, h1) th pixel of the key image. The reverse process will be applied for decryption.ISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1855
  6. 6. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST)Encryption can be done by left or right shift of bits of each pixel of the original image.6. ConclusionIn this paper we have proposed a technique of well known k-n secret sharing but on color images. At the time ofdividing an image into n number of shares we have used random number generator, which is a new techniquenot available till date. This technique needs very less mathematical calculation compare with other existingtechniques of visual cryptography on color images. This technique only checks ‘1’ at the bit position and dividethat ‘1’ into (n-k+1) shares using random numbers. In most of our experimental results, each share reflects verylittle or even no information regarding the original image to human eye.But the main drawback of the algorithm is in its number of loops. For n=6, k=5 and a 32 bit pixel with 50% ‘1’,number of loop operation required is 32. For n=6, k=4 with other conditions same, number of loop operationrequired is 48. For n=6, k=3 with other conditions same, number of loop operation required is 64. The followinggraphs show these. Number of 1 bit VS Loop (N-K+1) VS Loop 35 70 32 64 30 60 25 24 50 48 Loop Loop 20 40 15 16 30 32 10 20 8 16 5 10 0 0 0 0 5 10 15 20 0 1 2 3 4 5 Number of 1 bit (N-K+1) Figure 7: Graph of Number of ‘1’ bit Vs Number of loop Figure 8: Graph of (N-K+1) Vs Number of loopsExcept this drawback the algorithm produces better result compare to some other existing algorithms. [12][13]References: http://ieeexploreprojects.blogspot.com[1] M. Naor and A. Shamir, “Visual cryptography,” Advances in Cryptology-Eurocrypt’94, pp. 1–12, 1995.[2] Ranjan Parekh, “Principles of Multimedia”, Tata McGraw Hill, 2006[3] John F Koegel Buford, Multimedia Systems, Addison Wesley, 2000[4] Li Bai , A Reliable (k,n) Image Secret Sharing Scheme by, IEEE,2006.[5] F. Liu1, C.K. Wu1, X.J. Lin, Colour visual cryptography schemes, IET Information Security, July 2008[6] Zhi Zhou el at. Halftone Visual Cryptography, IEEE Transactions On Image Processing, Vol. 15, No. 8, August 2006[7] Schildt, H. The Complete Reference Java 2, Fifth Ed. TMH, Pp 799-839[8] How to Split an Image into Chunks - Java ImageIO, http://kalanir.blogspot.com, Feb 2010[9] Krishmoorthy R, Prabhu S, Internet & Java Programming, New Age International, pp 234.[10] Samanta S, Kandar S, Dutta S, Implementation of Invisible Digital Watermarking on Image, The Bulletin of Engineering and Science’ ISSN:09747176 SEP, 2008 Vol.3|NO.2[11] SaiChandana B., Anuradha S., A New Visual Cryptography Scheme for Color Images, International Journal of Engineering Science and Technology, Vol 2 (6), 2010[12] Nakajima M, Yamaguchi Y, Extended Visual Cryptography for Natural Images, 10-th International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision2002[13] Kumari K, Bhatia S, Multi-pixel Visual Cryptography for color images with Meaningful Shares, International Journal of Engineering Science and Technology Vol. 2(6), 2010Apendix:1 Java Language implementation isint c=0;int a=(Integer.parseInt(value.substring(0,8),2))&0xff;int r=(Integer.parseInt(value.substring(8,16),2))&0xff;int g=(Integer.parseInt(value.substring(16,24),2))&0xff;int b=(Integer.parseInt(value.substring(24,32),2))&0xff;img_cons[c++]=(a << 24) | (r<< 16) | (g << 8) | b;2 The source code written in Java isint rand_int = randomGenerator.nextInt(n);ISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1856
  7. 7. Shyamalendu Kandar et al. / International Journal of Engineering Science and Technology (IJEST)3 Java language implementation for saving an image ispublic static Image getImageFromArray1(int[ ] source, int width, int height, int share) throws IOException { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); image.getRaster().setDataElements(0,0,width,height, source); Graphics2D gr = image.createGraphics(); gr.drawImage(image,width,height,null); gr.dispose(); ImageIO.write(image, "png", new File(share+"<file name>")); return image; }  http://ieeexploreprojects.blogspot.comISSN : 0975-5462 Vol. 3 No. 3 Mar 2011 1857