Visual XOR based encryption with random one time pads.
Visual Cryptography is an approach to split information over image shares, where:
- Every share by itself leaves no information about the content.
- An image superposition (images printed on foil, stacked arrangement) reveals the original secret.
This repository hosts an open source implementation.
- The software first creates a downsampled, black&white abstraction of the input image.
- Then it generates a random One-Time-Pad (OTP) and applies it to the abstraction to create two visual shares.
- Perfect alignment of shares reveals the secret, while any other superposition tells nothing about the original.
One Time Pads hide a secret with random entropy. Decryption is not a question of computational power. Holding only one share, the set of potential outcomes contains any possible image.
Imagine a 2x2 test image:
Running this library will create a random one time pad and apply it to the test image. This results in two more images, which serve as secret shares:
- Image 1: Stems from the One-Time-Pad:
- Image 2: Stems from the XOR combination of test image and One-Time-Pad:
The logical NOR operation of above shares (which corresponds to visual XOR, because the human eye interprets dithered areas as brighter) results in a visual decryption of the original image (secret):
- Compile the sources:
mvn clean package
- Run the program:
java -jar target/VisuCrypt.jar path/to/source/image.jpg
or
mvn clean package exec:java -Dexec.args=path/to/source/image.jpg
- Print shares, generated next to source image as
share1.png
,share2.png
. - Place printed shares one on top of the other, hold against a light source.
Note: good PNG input size is ~180x180. Most printer progrems upscale with dithering (ugly). Prevent that with a manual upscale that quadruples every pixel:
convert share.png -filter point -resize 400% upscaledshare.png
(imagemagick)
Maximilian Schiedermeier, 2018 - 2022
At the time employed at INSA Lyon, LIRIS Labs.