1. Member
Join Date
Oct 2010
Posts
22
Rep Power
0

## Steganography

I'm teaching myself a little bit of steganography, which requires a fairly large amount of bit conversion. The source code I have shows me some of how it works but I'm not entirely sure where and how it works. If you could help/point me in a direction that I can fully understand this I would be greatful

~Aedon

::The code snippet::

Java Code:
private byte[] bit_conversion(int i)
{
byte byte3 = (byte)((i & 0xFF000000) >>> 24); //0
byte byte2 = (byte)((i & 0x00FF0000) >>> 16); //0
byte byte1 = (byte)((i & 0x0000FF00) >>> 8 ); //0
byte byte0 = (byte)((i & 0x000000FF)       );
//{0,0,0,byte0} is equivalent, since all shifts >=8 will be 0
return(new byte[]{byte3,byte2,byte1,byte0});
}
Last edited by AedonetLIRA; 01-11-2011 at 02:20 AM.

2. Are you familiar with bitwise operations (AND, IOR, XOR, NOT), and arithmetic shifting?

3. Steganography is about hiding data in other data. Picture data is especially well suited for this purpose because of its structure: pictures are matrixes of pixels and a single pixel is a combination of the colours red, green and blue. (There are other colour systems but stick to RGB for now). Each of the R, G and B values are small integers, typically in the range [0,255]. The higher the value the more intense the perception of the colour. Human eyes are not very sensitive to small intensity fluctuations, e.g a red value of 255 can't be distinguished from 254 (a difference of 1 bit).

This is the clue to data hiding: suppose we manipulate a picture as follows: (I'll ony use the red value): if the red value is odd subtract one from the value for each odd valued pixel.

After this manipulation we'll have a picture with the lowest bit of the red colour value set to zero. We can use those bits: we can 'embed' other data in it by setting the low bits to our data; this only changes the lowest bit of the colour and the fun is: a human being can't see it. Of course a computer program can find the data easily if we know how the data has been added to the picture. Just playing with the lowest bits of the red colour component is too naive so more advanced steganography methods use more tricky ways to plug in their own bits in the data but the principle is always the same: use those bits that can't be seen by human beings.

Jos

4. Member
Join Date
Oct 2010
Posts
22
Rep Power
0
@JosAH: Thanks for your reply, I am aware of what Steganography is, I was more looking at What was going on with the source.
@Zack: Thanks for your reply, I also know he is shifting but I am not following how or why it is done. A buddy of mine just used an array of bit values instead of the shift described above. I was just looking for insight on that.

5. Originally Posted by AedonetLIRA
@JosAH: Thanks for your reply, I am aware of what Steganography is, I was more looking at What was going on with the source.
The code you showed us chops an int apart in an array of four bytes, i.e. if the int is 0xAARRGGBB, the byte array contains the values 0xAA, 0xRR, 0xGG and 0xBB.

kind regards,

Jos

6. Member
Join Date
Oct 2010
Posts
22
Rep Power
0
I see, Thanks that is perfect.