You can easily hide a text message inside a Bitmap by altering the header.This is extremely easy than hiding the message by altering the LSB for each byte in the bitmap data.
lemme explain how this can be done.
Bitmap contains two headers (other than the optional colormap) namely ,BitmapFileHeader, and BitmapInfoHeader.We needn't care about second one ,all we care is the the first header, BitmapFileHeader.First 14 bytes of bitmap makes up the BitmapFileHeader whose structure can be shown as below
Type | 2 Bytes | Specifies the file type, must be BM |
File Size | 4 Bytes | Specifies size of the file in bytes |
Reserved | 2 Bytes | Reserved; must be zero |
Reserved | 2 Bytes | Reserved; must be zero |
Offset | 4 Bytes | Specifies the offset, in bytes, from the beginning of FILEHEADER to the bitmap bits |
It is the File Size and Offset Values that we are intersted in.Lets Consider an example of bitmap file
Type | . |
File Size | X |
Reserved | . |
Reserved | . |
Offset | Y |
As seen in figure the size of file is X and the offset value is Y.Now, what we actually do is that we will insert the message right after the header block and before the bitmap Bits.
Type | . |
File Size | X + Size of message |
Reserved | . |
Reserved | . |
Message | Secret |
Offset | Y + Size of message |
As you can see , we have also increased the size of file and offset value to accomodate the message.
Thats it !!!! We have hidden a secret message inside a Bitmap. Isn't it simple ???
You can find a C# implementation of my code in planet-source-code.com.