views:

133

answers:

3

What are the basic and simpliest steganography algorithms and methods?

I mean the steganography applied to images.

How does simple program that hides data to images work? What are the main techniques used? How does the program recognize the encrypted message in image without the source image?

+3  A: 

Modifying least significant bits of bitmap pixels.

For a nice overview, see this page

Dario
A: 

There are literally infinite ways to hide information in images.

One simple way is to notice that changing the least significant bit of each RGB value doesn't make a noticeable difference, so setting the least-significant bit of every byte in the image gives us (#-bits-in-image / 8) bits to store hidden data in.

BlueRaja - Danny Pflughoeft
+6  A: 

What are the basic and simpliest steganography algorithms and methods? I mean the steganography applied to images.

I have written a library for this in the past a long time ago so I can describe the process.

Basically if you have a file format, let's say the 24-bit BMP format. First you need a way to read and write pixels into that file format. Either you can use a library or write your own once you learnt what the file format is.

An image can be looked at as a series of pixels. Consider a 4x4 pixel image:

x x x x
x x x x
x x x x
x x x x

Number these pixels from 1 to 16:

01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16

Each pixel that is numbered above has a red component, a green component and a blue component. Each of those components are 1 byte each and so each component can be looked at as a value of 0 to 255. (24-bit = 8bits for red, 8 bits for green, 8 bits for blue). So each of the numbers above have 3 sets of values from 0 to 255.

So in the above example with a 4x4 image you have a total of 16pixels*3color_components = 48 bytes of data in your image. Typically what you will do is use only the least significant bit of each color component to encode your image. In which case you would have 48 bits bits of data available for you = 6 bytes available to you to encode any 6 byte message you want.

To make this easier though let's just look at encoding a simple 3 bit message into a single pixel. And let's assume we are only using 1 bit per color component. Let's say we want to encode the 3 bit message: 111

Here is an example of the value pixel 1 above has before you encode the data:

R: 10101011
G: 11111010
B: 00011010

What you do is change only the least significant bit to the new data:

R: 1010101 1
G: 1111101 1
B: 0001101 1

The pixel will look the same to the human eye, but now you are using the least significant bit to represent the data you wanted to encode.

If you want to encode more than 3 bits of data into a single pixel you can also do that. What happens is that you will encode more than just the least significant bit, you can use the least 2 significant bits, or the least 3, etc. The more bits you use, you will start to notice a little bit of a difference in the image quality. You can use up to 7 bits though and your image will still look recognizable.

Typically you will have a lot more than 3 bits of data you want to encode though. The more data you want to encode, you will have to either have more pixels, or use more bits per pixel to encode the data. Let's say you have 9 bits of data you want to encode, well if you are only using the least significant bit, then you need 3 pixels to encode that information. If you want to only use 1 pixel though you can do that by using the 3 least significant bits per color component to encode that data.

To do this type of work you'll probably want to create some functions for easily working with bits of data that abstract away the complexities of dealing constantly with bitwise operators.

The technique will vary for different file formats, but the concept is the same. Steganography can also refer just to hiding the data for example in a GIF extension block even. Typically you hide it by varying the pixels of the image though, or in some file formats the color lookup table.

Some images have a color lookup table in the header, and then the pixels are indexes into those color lookup tables. What you can do is re-order the color lookup table so the most similar colors are close together, then you can encode data both into the color lookup table itself and into the indexes of the pixels. Because it won't matter if the index slightly changes because the lookup table is ordered according to being similar.

You really do need to have an understanding of the file formats to do this type of work though. Or at least be using a library that can manipulate the file format and file data for you. If you are really interested in this topic I suggest to start with a simple file format like BMP and to learn it. You can always find file format specifications on sites like www.wotsit.org.

How does the program recognize the encrypted message in image without the source image?

You are correct. The program that decodes the information does not need the source image. How this works is that it simply does the reverse, the program will need to know how many bits of data you enoded using and use the same to decode. It will simply iterate over each pixel and combine the bits into bytes and write those bytes out to a file.

Brian R. Bondy
Very elaborate answer, great description of the "least significant bit change" method. Thanks.
tomp
For palette-based formats you can decrease amount of real colors to free some indexes and then fill them with RGB of the most popular color. That will allow to avoid noise in the picture. Encoding of message will be a bit different from just slicing bits and replacing them in an image. That's because you can allocate 3 indexes and if there 2 places in the image you'll have 3**2 = 9 different messages.
ony
Ya basically there are no hard fact rules of what steganography is defined to be, if you understand the file format and are creative then you can accomplish it.
Brian R. Bondy