09.05.08

Audio Steganography

Posted in Uncategorized at 1:48 am by David Kellogg

I was inspired by Ohmpie’s post, “Encoding an image to sound” about sound in gray scale images. One extension of his work is steganography. Steganography aims to send a message in an image without others’ knowledge that an encrypted message is attached. I started with the following image, upon which I could add data.

pre-vatican

The following image has hidden audio data encoded in the colors used in the image.

post-vatican

The audio encoded in the image was extracted from this image. You can listen to it.
Audio after decryption

A closer look at the image shows some of the dithering caused by the extra data.

vatican_inset

How does it work?

For this project, I worked with X-Pixmap (XPM) files, which are trivial to manipulate in Gimp and Perl. I sorted the colors using a 3-D Hilbert curve. It had to be 3-D curve to account for red, green and blue. The Hilbert curve guarantees that not one color will differ from the next significantly. I sorted the entire spectrum into one dimension. I only used one out of every 16 colors in the palette. This leaves me with 4 bits per pixel. For this image size, this allows me to embed 34kB of data of any type. For embedding the hidden data, I sorted the colors based on the scheme described above, then dithered the color slightly to add the 4 bits. To decode, I sorted the color palette, computed the length along the Hilbert curve, modulo 16, then took the remainder, which I concatenated to re-create the data.

The code for encoding and decoding is here.

Finally, this image contains this entire blog post.

whole_post