Sign in to follow this  
Followers 0

Hide text in bitmap

13 posts in this topic

Posted (edited)

Hi!

I found this interesting article on codeproject so I decided to use the idea in an autoit script since it didn't seem to hard :)

It's basically a way to hide a string inside the bitmap data in a .bmp file. The basic idea is to use just 1 bit of each byte in the bitmap data to save the message, this means that each pixel that is modified inside the bitmap is just modified by one single little color shade (thus making it impossible for a human to notice the difference), so for example 0x000000 becomes 0x000001.

To be able to extract the string you need to know what offset the string is saved into in the bitmap, thus making it smewhat secure for peeping eyes :o

A big thanks to james3mg for his Number base conversion UDF.

The syntax is easy:

HideMessageInBitmap("file.bmp","My message",SECRET OFFSET HERE)

GetMessageInBitmap("file.bmp",SECRET OFFSET HERE)

Here's a bitmap I have encoded a message at offset 234 for example:

test.bmp

UDF ( With Number base conversion UDF):

Bitmap_Message_Hider.zip

Ps. Since png doesn't destroy any image data, a encoded message will survive a png conversion :D

:D

Edited by monoceres

Share this post


Link to post
Share on other sites



Posted

I have seen this elsewhere on the forums too. Nice job though!

Share this post


Link to post
Share on other sites

Posted

This is awsome. :o:)

Share this post


Link to post
Share on other sites

Posted

Very nice!

Share this post


Link to post
Share on other sites

Posted

I have a question.

Is there any limit to the text to hide it in the picture?

Share this post


Link to post
Share on other sites

Posted

I have a question.

Is there any limit to the text to hide it in the picture?

Yes and it depends of the size of the bitmap. But it's quite easy to calculate.

If you for example have a bitmap that is 262144 bytes large (256 kB) you have 262090 bytes for text storage (since the bitmap header is 54 bytes).

Then we have to subtract 32 bytes to save the information that contains how many chars there are in the bitmap. That leaves us with 262058 bytes. Now usually one char takes up 1 byte of storage, but since we're only using the last bit in every byte in the bitmap we need 8 bytes to store one char. Therefore we need to devide the available space with 8. Which leaves us with 262058/8=32757,25= 32757 chars available for storage :) Of course this assumes that the offset is 0.

Here's a quick formula:

MsgBox(0,"",CalculateLimit(256*1024))

Func CalculateLimit($BitmapSize,$Offset=0)
	Local $BitmapHeaderSize=54
	Local $TextHeaderSize=32
	Local $OneCharSize=8
	Return Floor(($BitmapSize-$BitmapHeaderSize-$TextHeaderSize-$Offset)/$OneCharSize)
EndFunc

:o

Share this post


Link to post
Share on other sites

Posted

This is awesome !!

Btw, how can I put different message at a different offset?

I'd try it, but the message is corrupted (sometimes return blank)

Share this post


Link to post
Share on other sites

Posted

This is awesome !!

Btw, how can I put different message at a different offset?

I'd try it, but the message is corrupted (sometimes return blank)

You just have to make sure there is enough room between the offsets. If you for example have the text "Hi!" at offset 100 the next offset can be earliest at offset 155 (32 bytes for length of string and 8*3 for the chars).

Share this post


Link to post
Share on other sites

Posted

@monoceres

Great job ! this is very funny :)

Cheers, FireFox.

Share this post


Link to post
Share on other sites

Posted

Very Cool! Just like in that movie "Along Came a Spider".

Share this post


Link to post
Share on other sites

Posted

Nice ! But I have a question...........

I had a Bmp with virus inside, when i scan it with Avast it shows AUTOIT VIRUS

Will it b possible???

But Now I Don,t hav that Bmp, Bcoz when i Having it i havnt kno abt AuToIt! :)

Share this post


Link to post
Share on other sites

Posted

No, that's not possible. This code merely changes the color data inside the bitmap. Even if someone did encode a virus into a bitmap it would only show up as an image. The image viewer would have no reason to execute to last bit of every RGB value.

Share this post


Link to post
Share on other sites

Posted

great job!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0