Modifying a Gramophone/Phonograph to work with an iPod
How I modified a replica gramophone so I could plug in a standard music player.
Visual encryption of images using the principle of the one-time pad.
Finding the Dimensions of the Player in Flash
Ways to determine the size at which your flash movie is playing back when embedded in a web page.
One-Time Image is a program written in Java to encrypt images using the principle of the one-time pad to create a pair of black and white images. Each appears as a 'snow' of black and white pixels, and no information can be extracted from either image on its own - unlike most cryptography, it is not merely 'very difficult' to extract information: an implementation of the one-time image principle with true random numbers is *perfectly* secure and unbreakable (in practise this program uses the default Java random number generator, and so isn't absolutely secure - information is provided in the source code on how to add your own random number generator if you want to make it so).
However, despite the fact that no information can be retrieved from either image on its own, if both are printed onto transparencies and one is laid directly over the other, the original image will immediately and clearly appear. One-Time Image is free and open-source - you can get the program and source code here.
How does it work?
The principle of the one-time pad was developed during World War One, though it was 25 years before a mathematician proved it was perfectly secure, as opposed to merely prohibitously difficult to break. It is a very simple substitution cypher, but with the twist that the key is the same length as the message. As a result each letter has its own unique (and random) rotation, making the encoded message proof against any sort of analysis without the key. The final result is a pair of random-looking message (one the encrypted message, one the key used to encrypt it) of the same length, either of which cannot be broken or analysed in any way on its own, but which can easily be decoded once the two are brought together.
One-Time Image extends the principle to that of images. First, the source image is converted to black and white (not greyscale, true black and white with pixels of only these two different colours).
Secondly a key image is generated, of the same dimensions, where each pixel is randomly set to white or black. Third, the original image is encrypted using this key - if the pixel in the key is white then the corresponding pixel in the original image is used in the encrypted image, whereas if the key pixel is black then the corresponding pixel in the original image is flipped (black to white, white to black) for the encrypted image. The result is two images of apparently random black and white pixels.
Finally, each image is then doubled in size - each pixel becomes a 2x2 square of pixels. Black pixels have black pixels in the top-left and bottom-right corners while the other two pixels are while, while a white pixel in the original image produces the opposite 2x2 square. These enlarged images are the final, encrypted ones - they have the appearance of random static, or snow, and neither one can be decrypted on its own no matter how powerful the computer or clever the analyst..
The trick is that, when printed onto transparencies and one is laid over the other (the order is irrelevant), the original image is suddenly revealed! This is because a black pixel in the original image produced pixels of different colour in the key and encrypted images (one black, one white). Since these black and white pixels became 2x2 squares with two black and two white pixels, when overlaid all four pixels in the square become black. However, a white pixel in the original produced pixels of matching colour in the key and encrypted images (both black, or both white). Hence the 2x2 squares in the final images are identical, and when overlaid half the pixels remain white. Hence, when you look at the image from anything but very short range, these 2x2 squares look grey while other look black.
If you don't have a printer and transparencies to hand, you can demonstrate it for yourself using Photoshop or some other image-manipulation program - take one of the output images and import/paste the other on top of it as a new layer and you'll see your original image.
What's it useful for? In the world of serious cryptography - not much. In practise it makes a lot more sense to use the same principles to produce a pair of USB keys rather than messing around with transparent sheets of printed static. And even then the one-time pad is mostly a curiosity: its lack of authentication, need to transport the message securely, need to dispose of the keys securely after use and other problems means its usage is limited.
It is, however, a useful tool for demonstrating the principle behind the one-time pad and cryptographic principles in general, since the decoding is automatic, instantaneous and very visual. The fact that transparencies are involved also makes it perfectly suited for use with overhead projectors if being formally taught. It's also fun to just play around with - I find it fascinating, the way two nonsensical images produce a meaningful one when overlayed (but maybe that's just me). You could also use it for activities like orienteering, by giving one transparency to a team and leaving the other at the point they need to locate (it'd be like a high-tech equivalent of those hole-punches they normally use).