Steganography

What is steganography?

Steganography is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity. (http://en.wikipedia.org/wiki/Steganography)

I got this assignment 2 months ago. In this assignment I have to create a program that allow some text (or any kind of data) to be inserted into an image using a key and get the text (or data) back using the same key. To insert the text, first we need to get the ASCII:

If the text is: ‘BOB’ then we’ll have the ASCII: 66,79,66 (in decimal)

Now we need to change it to binary code. So, we get the binary code:

01000010100111101000010

note that the binary code need to be 8 digits long

Now we generate the pixel order using the key,  also called seed.

After we get the order, now we insert it to the picture. First, we get the pixel color in RGB, for example this color

has R value 100, G value 175, and B value 200.

In binary code

R: 1100100

G: 10101111

B: 11001000

now we change some of the color binary code LSB(Least Significant Bit) with our text binary code

the less LSB used the better, which means the less difference between the result image and the original image.

For example, we use 2 LSB for the insertion

data = 01000010100111101000010

R: 1100100 –> change 2 bits with our data –> 1100101

G: 10101111 –> 10101100

B: 11001000 –> 11001000

data left after first pixel insertion = 10100111101000010

now we move to the next pixel, do the same until all the data is inserted.

To extract the data from the picture, first we generate the pixel order, and get the bits from the colour (the same number of LSB used in insertion) and append them all.

Next, we get the ASCII code from the binary code and change it back to text.

That’s the basic of steganography using digital image. I’ll give some more detail at the next post.

Feel free to leave a comment.