Steganography is the art and science of writing hidden messages in such a way that no-one apart from the sender and intended recipient even realizes there is a hidden message. By contrast, cryptography obscures the meaning of a message, but it does not conceal the fact that there is a message.
Lemon juice on paper never worked for me, and it’s hard work hiding a text message as a pattern within a larger text message. Sadly my hair is too fine for Histiaeus’s inspired shave-a-slave trick.
In a digital age, steganographers have it easier. The larger the carrier message the easier it is to disguise a payload within it. My mobile phone has a 3 megapixel camera; I could embed the entire text content of this website (tarred and bzipped) within a single one of its photos without anyone noticing. The Wikipedia page on steganography has a remarkable example of a picture of a tree which, after some bit-shifting, turns into a passable picture of a cat!
The Python Imaging Library (PIL) makes tinkering with images a snip. Here’s a short program to hide messages in images, and to reveal such messages. PIL isn’t ready for Python 3.0 yet, so I’m using 2.6. Note in passing the use of a couple of recent additions to my favourite module, itertools.product and itertools.izip_longest.
The code is available via anonymous SVN access at http://svn.wordaligned.org/svn/etc/steganography.
? For brevity, I haven’t provided a nice user interface to
. The short main program is (intentionally) lightly obfuscated.
modifies the supplied image argument — use
if this is a problem. You must also choose a lossless format to save the disguised image: I recommend PNG, but please do check
works on any saved image.
Note there’s a cool steganography Firefox extension called FireSteg. It is (in my opinion) the easiest steg program to use. It’s on Softpedia and Mozilla’s site. The Java source code is embedded in the extension itself for those who want to study it. It’s mainly for those who want to put hidden files on image hosts, because the browser integration allows you to just right-click an image and extract the file(s) immediately. Although anyone with the extension can read files from images encoded with it. If you want to password-protect the file, you could always encrypt it before hiding it (using an encrypted RAR or 7zip archive, for example).
Related Posts: On this day...
- Talented shoplifting family show their stuff on video - 2011
- PS3 completely hacked. Security on the system is apparently the worst security ever seen. - 2010
- Differences in the generations - 2009
- Bruce Schneier on this week's air-terror-scare and TSA's response - 2009
- The future of Compiz - 2008
- Have a safe New Years! - 2007