INTRODUCTION
Visual Cryptography is a graphical form of information concealing.
In a 2-out-of-2 Visual Cryptography Scheme a dealer will "split" a secret image
into two shares, print the shares onto separate transparencies and
hand them to the participants to the scheme. If the two participants
come together, they'll be able to reveal the secret image without a computer,
perfectly superimposing the transparencies they own.
Analyzing a single share no one will be able to obtain any information
considering the secret image no matter the computing or the analyzing power.
In an Extended Visual Cryptography Scheme, both the secret image and the shares
are meaningful images like a landscape, a building or a beautiful girl,
hiding the very intention to conceal a secret.
PyEvcs is a command line Python application allowing you to experiment
with Extended Visual Cryptography Schemes for "natural" grey - scale images.
Visual Cryptography was invented by Moni Naor & Adi Shamir.
The application bases on a two-out-of-two Extended Visual Cryptography Scheme for
"natural" (continuous tone) images introduced by M. Nakajima and Y. Yamaguchi.
For more information considering the algorithm used see my article in Dr. Dobb's Journal:
http://drdobbs.com/security/184406280
LICENSE
Copyright (C) 2011 Daniel Stoleru
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, go to http://www.gnu.org/licenses/gpl-2.0.html
or write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
PREREQUISITES
PyEvcs is a Python application, so you'll have to have a Python
interpreter installed on your machine. If not, just go to www.python.org
and download and install the last Python 2.x version available.
NOTE. The application wasn't tested with any Python 3.x interpreter
Also, you'll need to install the Numerical Python package - NumPy. Go to
http://numpy.scipy.org/ download the NumPy package corresponding
to your Python version and operating system. Follow the installation
instructions and install the package on your system.
Another package you'll need is Python Imaging Library - PIL.
PIL is available at: http://www.pythonware.com/products/pil/
Grab the package corresponding to your Python version and
operating system, follow the installation instructions and
install the package.
INSTALLATION
PyEvcs doesn't need any special installation procedure.
Just download the corresponding archive from https://sourceforge.net/projects/pyevcs/
and unpack it into a directory of your choice.
After unpacking the archive you should have the following files into
the chosen directory:
pyevcs.py
bitmap.py
dithering.py
pixelmatrix.py
utils.py
cameraman.tiff
mandril.tiff
lena.tiff
README.txt
The three *.tiff files contain example images you can use in order to test the application.
PROGRAM USE
Open a shell depending on your operating system and call:
$:python pyevcs.py [options]
Options:
-h, --help show this help message and exit
-i IMAGE, --image=IMAGE
the secret image specified as filename.ext
-x SHARE1, --share1=SHARE1
first share. specified as filename.ext
-y SHARE2, --share2=SHARE2
second share. specified as filename.ext
-t, --trace show intermediate images
NOTE. You'll have to have the Python interpreter into the PATH
environment variable.
EXAMPLE
$:python pyevcs.py -i cameraman.tiff -x lena.tiff -y mandril.tiff
HOW THE PROGRAM WORKS
In the simplest setup a 2-out-of-2 visual cryptography scheme "splits" a secret image into two shared images.
The shared images are printed onto separate transparencies and handed to the two participants in the scheme.
To decrypt, the participants simply stack their transparencies and are able to visually recognize the recomposed secret message.
PyEvcs uses three images as input data: the secret image (information) you want to conceal
(for instance the Cameraman in the package distribution), and two images representing
information to be shared (the Mandril and Lena as example). This model mainly consists of two phases:
1. halftoning and
2. encryption.
All the three images given as input should be 8-bit grey-level images and must have the same dimensions.
You can use any of the usual image formats: TIFF, GIF, JPG, PNG, BMP, etc. See the PIL documentation for more
information considering the supported formats.
1. First, the application transforms the gray-level images into simple black-and-white images in such a way that
they are still meaningful; that is, the obtained black-and-white replications (called "Intermediate Images") mimic
the aspects of the continuous tone ones.
PyEvcs uses an ordered dither algorithm, similar to the dithering techniques used for newspapers.
To illustrate, I have defined two different dithering masks, but any viable mask can be easily inserted into the application
and can be tested. Start the application with the -t (--trace) parameter in order to see the dithered images.
Simply dithering the three images is not enough to obtain the proposed Extended Visual Cryptography Scheme.
2. You also need to further process (encrypt) the images. This process is the most interesting part of the model.
During the dithering process at any pixel in the original - continuous tone - image is expanded to a matrix of
black and white subpixels, with the number of black or white subpixels determined by the gray level of the original pixel.
You denote the number of white subpixels in a pixel's expanded (halftoned) version by pixel transparency.
The encryption process applies pixel-by-pixel to the three halftoned images, controlling the transparencies
of the shared pixels such that the required transparency of the target pixel is obtained.
The decryption should be done without a computer. The two shares obtained during the encryption process should pe printed
on separate transparencies. If you perfectly supperimpose the two transparencies, you should be able to visually reconstruct
the original image.
PyEvcs will simulate the supperimposing showing you the image obtained by applying the logical OR operator
pixel-by-pixel between the two encrypted share - images.
For more information considering the used model and implementation see my article in Dr. Dobb's Journal.
SUPPORTED PLATFORMS
Windows - XP/Vista/7
Linux
Sun Solaris