# 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.

The shares are :

Share 2

Share 1

﻿
﻿
﻿
﻿
﻿
﻿
﻿
﻿
﻿

﻿
﻿
﻿
﻿
﻿
﻿
﻿
﻿
﻿
﻿

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!

### 5 responses to “Visual Cryptography example”

1. Ajay Kumar says :

Awesome..!

2. awning says :

Hmm it appears like your site ate my first comment
(it was extremely long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any helpful hints for novice blog writers? I’d certainly appreciate it.

• pratima says :

i want the matlab code for vip synchronization in visual cryptography. Can you please send it to me? email id- pratima.nikate@gmail.com

3. Thanks for your marvelous posting! I definitely enjoyed reading it, you happen to be
a great author.I will make sure to bookmark your blog and will eventually
come back later on. I want to encourage that you continue your great writing, have a nice weekend!

4. sai kumar says :

where is the source code

Playwright Conversations

Black Playwrights, Black Artists, Black Plays

Walk The Line

Guided by Karma, Dharma and Drama!

Pink Chai Living

Creativity + Entrepreneurship + Motherhood

The Write Side

A little bit of this and a little bit of that!

The Domestic Man

Gluten-free & Paleo-friendly recipes, inspired by traditional & international cuisines.

today was meaningful

a collection of thoughts, life lessons, and days full of meaning.

Blogging for a Good Book

A suggestion a day from the Williamsburg Regional Library

story lovers unite

TED Blog

The TED Blog shares interesting news about TED, TED Talks video, the TED Prize and more.

A Little Blog of Books

Book reviews and other literary-related musings

Scriddles

scribble doodle sketch

Just another WordPress.com site

FROM THE WILDERNESS

Veritas Vos Liberabit

Freedom to Fail

An aspiring young professional with a blog

Bytes won't bite ...

Networks | OS | Games | Fun | 11111000011