blog

Looking at Steganography

by | Jul 24, 2012 | Developer Blog | 0 comments

With the help of one of my favorite news aggregators, I discovered this article on using JavaScript and the canvas element to hide information inside images. I’ve long been fascinated by steganography and this article and demonstration makes it even more accessible. If you can’t be bothered to read the article, it describes a method of using the HTML5 File API and the canvas element to embed a message in images.
The challenge of steganography is making it accessible without making it obvious. Steganography fails when the presence of a hidden message is obvious. The art and science of detecting steganography has been a topic of study for years. There are papers on hiding messages. There are papers on finding those messages. There are papers on hiding multiple messages so you can reveal one and deny the presence of the other.
Let’s look briefly at how the aforementioned JavaScript and canvas tool changes our images. Here’s a white square:

Here’s how I made it with ImageMagick:

$ convert -size 100x100 canvas:#ffffff white.png

Let’s embed the message “One if by land, and two if by sea;” in the white image with the password “Henry Wadsworth Longfellow”. Here’s what it looks like:

white_message.png

As you can expect with decent steganography, it’s hard to tell that there is a message embedded. Since only the least‐significant bits are being modified, the difference is subtle. Let’s look at the difference between the two images:

$ composite white.jpg white_message.png -compose difference white_difference.png

white_difference.png

That doesn’t seem to help much. The changes become much more obvious when we expand the contrast. Here’s what we get when we normalize the image:

$ convert white_message.png -normalize white_message_normalized.png

white_message_normalized.png

Now we can see what actually changed. Now this is a simple case—we had the source image and the image with the embedded message. However, it’s clear that the changes made to embed our image have generated a pattern atop the image.
In a future post, I’ll look at how software can look for these patterns.

+ more

Accurate Timing

Accurate Timing

In many tasks we need to do something at given intervals of time. The most obvious ways may not give you the best results. Time? Meh. The most basic tasks that don't have what you might call CPU-scale time requirements can be handled with the usual language and...

read more