PCPlus 323: Secrets of Steganography

Ah, steganography, that art of hiding some message in plain sight. These days we’re attuned perhaps to just thinking of hiding a digital message by modifying the bits encoding an image, but it does have a long illustrious history before computers ever came along. There’s Herodotus and his idea of inscribing a message on a wax tablet, underneath the wax; microdots used by spies in WWII and later; using code-words in an otherwise normal-looking letter. But in the age of computers steganography really hits its stride.

PCPlus logoJust think about it for a moment. The images we view on a screen are made up of pixels. Each pixel is 3 bytes of information: a byte each for the level of red, green and blue (I’ll ignore opacity). That’s 256 levels each. However the human eye really can’t differentiate the differences between a pixel that has an RGB value of, say, (200, 0, 0) and one that is of value (199, 0, 0). Just for fun here’s what those colors look like on your screen as you read this:

 
 

But...which is which? Is it the darker color on the top or the lighter? I forget… Let’s mix the colors up a bit and add some green and blue to make a lavender color:

 
 

Again it’s hard to discern any difference and I’ve even made these blocks 20 pixels to a side. So imagine a photo (obviously a BMP rather than a lossy JPEG) where, say, the first 8*100 bytes of pixel information encode a 100-character message, so there’s one bit of message per pixel. If the green channel is even, that’s a 0 bit, it is is odd, that’s a 1 bit, say. I would wager you wouldn’t notice that the image had been altered at all. I just post it somewhere public, say Facebook or Flickr, and everyone thinks it’s a wonderful photo, expect my compatriot who just decodes it with a simple program to get the message.

Unfortunately, life isn’t as simple as all that. The reason is that photos and images are JPGs and the JPG algorithm is a lossy one. The compression algorithm will smear out any simple color encoding like this. So for JPGs the problem is a little harder, but definitely not insurmountable. (For a idea of how JPG encodes and compresses an image see this previous PCPlus article, although this current article tries to lay out the basics.) In this case, you can fiddle the quantization matrices to embed the message, or play around with the Luma channel.

This article is famous – at least in the Bucknall household – for its diagram of how photo steganography works, using a stylized cat. There is no end to my drawing abilities…

This article first appeared in issue 323, July 2012.

You can read the PDF here.

(I used to write a monthly column for PCPlus, a computer news-views-n-reviews magazine in the UK, which sadly is no longer published. The column was called Theory Workshop and appeared in the Make It section of the magazine. When I signed up, my editor and the magazine were gracious enough to allow me to reprint the articles here after say a year or so.)

Loading similar posts...   Loading links to posts on similar topics...

No Responses

Feel free to add a comment...

Leave a response

Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.

  •  Emphasize with italics: surround word with underscores _emphasis_
  •  Emphasize strongly: surround word with double-asterisks **strong**
  •  Link: surround text with square brackets, url with parentheses [text](url)
  •  Inline code: surround text with backticks `IEnumerable`
  •  Unordered list: start each line with an asterisk, space * an item
  •  Ordered list: start each line with a digit, period, space 1. an item
  •  Insert code block: start each line with four spaces
  •  Insert blockquote: start each line with right-angle-bracket, space > Now is the time...
Preview of response