There’s a really neat technique for doing simple encryption that you can decrypt with your eyes. It goes like this, assuming that your data is a black-and-white image:

pixels

First, make a new image with the same size as your original image. Fill it in totally randomly.

Now, resize your random image to have twice as many pixels in each dimension. Each 2x2 pixel square of the resized image gets one of these “macropixels”:

macropixels

One has the top-left and bottom-right pixels black; the other has the top-right and bottom-left pixels black. Let’s say that we’ll replace black pixels with the left image and white pixels with the right image. Your new image will have exactly half of its squares black, and the other half white. This is your key (although it doesn’t actually matter which side is the “key” and which is the “data”). Here’s an example:

key

Now, take your original image, and encode it like this: where there’s a black pixel, take the macropixel that’s different from your key, and where there’s a white pixel, take the one that’s the same as your key.

ciphertext

Notice that this new (“ciphertext”) image has no information from the original image. If your original pixel was black, there’s a 50-50 chance that it will be the same as the black pixel from the key, and a 50-50 chance that it will be different. It’s the visual version of an xor-based one-time-pad.

Now comes the really cool part: to decrypt the image, you can print the key on a transparency, and overlay it on the ciphertext:

decrypt

You’ll see fully-black macropixels where the original image was black, and half-tone where it was white. No special hardware needed — just apply eyeballs.

As part of the Museum of Math’s opening puzzle hunt in 2012, I used this to create a fun reveal. They had transparent disks designed to be overlayed to display moiré patterns. Instead, I encrypted a puzzle answer, and printed the key on one disk and the ciphertext on the other. When the disks were rotated to the right angle, the answer image would pop out. Of course, this isn’t very secure — if you look at the images, you’ll see the grid axes, and then there are only four possible rotations. But if you don’t have one of the disks, it’s totally secure. And it’s a cool effect. When I visited the museum recently, the museum staff mentioned that the Fitzwilliam Museum had been inspired by my little toy, and have a version of it in their upcoming codebreaking exhibit (opening October 24th). So if you happen to be in Cambridge (the one in the UK) between next week and next April, please drop by and take it for a spin.


Previous post: Set Tactics