Digital Disappearing Ink: Steganography in C# - ' Hiding Messages in RGB ' (
Page 2 of 4 )
Images">
Hiding Messages in RGB Images
This article will talk about RBG images as Steganography carriers, and simple text messages as the payload. We'll use the BMP file format. And since the .NET framework saves BMP files as RGB images plus alpha bytes, I'll be talking about bitmap files having four bytes of data for each pixel in the image. In other words, each pixel has a byte with a red value, a byte with a green value, a byte with a blue value, and a byte with an alpha value.
ADVERTISEMENT
For more information about image processing, see the article Image Processing in C# here on DevSource.com.
Please note that GIF images have palette-indexed pixel values, which requires an entirely different approach then we're going to present. JPEG images pose a different challenge than the GIF images since they undergo lossy compression when they're saved. If we used the approach that will be used in this article for JPEG images, part of the message data would be lost. At a later time, I'll write articles that solve the GIF and JPEG issues.
Once again, each pixel's color is determined by four bytes of data. And each byte of data has eight bits. In almost every case, the least significant bit can be removed (and just made 0) without the slightest perceptible difference. The following two images show the original followed by an image with the least significant bit masked off.
In fact, there is a theory known as "Just Noticeable Difference" (JND) that says small changes won't be noticed. Removing the least significant bit from each data value amounts to less than one half of a percent of the pixel's color definition.
For many images, more than one bit can be discarded without a noticeable difference. Images that lend themselves to the loss of more than one bit of data tend to have solid shapes and at least a mid-level brightness.
Making Room For Data
With one or more bits discarded, there is room for hidden data. The more bits that are removed, the more room that exists for data. Since the least most significant bit doesn't perceptually alter the image, it can be set or not set without notice. The least significant bit(s) can be used to store the hidden message. The image into which the message is hidden is known as the carrier, the text message that we'll hide is the payload.
Hiding the Data
Text can be hidden in the least significant bit of the carrier image, one bit at a time. The letter 'A' is 01000001 in binary. In order to hide the 'A' character in the carrier, the first low bit in the carrier will be 0, the next 1, the next 0, the next 0, and so forth until the entire letter is hidden.
An Illustrated Example
Here is a set of illustrations that will show the principle of hiding a text message in bitmap data.
Manipulating Society through Technology
Jeremy Bailenson, Director of the Virtual Human Interaction Lab at Stanford University, talks about virtual reality, avatars, Moore's law, how real world behaviors influence online reality, and societal manipulation through technology! >> Play video >> Read article >> See all videos