Visual Cryptography example
Here is something me and a friend of mine implemented. It is called Visual Cryptography.
Okay, now what is VC all about. Consider you have an image which you wish to have as a SECRET! The condition is you and your friend should have a part or ‘share’ of the image which individually will not make any sense but when the 2 shares overlap, you can discover your secret. This is an implementation of Shamir’s Secret Sharing techniques (Yes the same Shamir from the RSA algorithm).
The image we used was black and white or in other words only 0’s and 1’s. This means if you want to see a point when the 2 images overlap light should be blocked. There are three possibilities for that (1,1), (0,1) and (1,0). These can be chosen on the basis of the input image or the secret image(here sayCHEESE.bmp). The file uploaded is in jpg format as bmp format is not a supported file format for upload here.
Okay, now getting on to how to actually split the image into 2 shares. When we have a binary image we can be sure that each pixel is 1 or 0. One decision you need to make is when it is a foreground pixel do you want to see it as white or black. We chose it to be black and the code written is keeping that in mind. Traverse each and every pixel in the image. If it is a foreground pixel then light should be blocked ie, the corresponding pixels so created should be (1,1) or (0,1) or (1,0). Remember to achieve this each pixel is split into 2 pixels. Yes, size is doubled but thats the price you need to pay for secret sharing! (Thats the EXACT same line my project guide said! 😛 ). This can be easily done using MATLAB as there are read image functions defined. Reading the bmp file through C and creating 2 new images would definitely be a mammoth task if I were to stick to C.
The code is available for download on the box.net on the right.
Once you obtain the shares, take a printout on transparency sheets and witness Visual cryptography in action! 🙂 It will look something like this:
For those of you who want to know more about this, I have uploaded a ppt on the right. Hoping you like it!