Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Hide text in bitmap


  • Please log in to reply
12 replies to this topic

#1 monoceres

monoceres

    asdf

  • MVPs
  • 4,020 posts

Posted 25 December 2008 - 04:25 PM

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:
Attached File  test.bmp   68.4KB   600 downloads

UDF ( With Number base conversion UDF):
Attached File  Bitmap_Message_Hider.zip   3.67KB   483 downloads

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


:D

Edited by monoceres, 25 December 2008 - 04:27 PM.

Broken link? PM me and I'll send you the file!








#2 James

James

    Universalist

  • MVPs
  • 10,223 posts

Posted 25 December 2008 - 04:51 PM

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

#3 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,587 posts

Posted 29 December 2008 - 01:45 AM

This is awsome. :o :)
When the words fail... music speaks

#4 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,346 posts

Posted 29 December 2008 - 06:23 AM

Very nice!

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#5 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,587 posts

Posted 29 December 2008 - 01:14 PM

I have a question.
Is there any limit to the text to hide it in the picture?
When the words fail... music speaks

#6 monoceres

monoceres

    asdf

  • MVPs
  • 4,020 posts

Posted 29 December 2008 - 04:17 PM

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

Broken link? PM me and I'll send you the file!


#7 slayerz

slayerz

    Prodigy

  • Active Members
  • PipPipPip
  • 160 posts

Posted 31 December 2008 - 07:04 AM

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)
AUTOIT I'm lovin' it!

#8 monoceres

monoceres

    asdf

  • MVPs
  • 4,020 posts

Posted 31 December 2008 - 10:17 AM

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).

Broken link? PM me and I'll send you the file!


#9 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,375 posts

Posted 31 December 2008 - 10:21 AM

@monoceres
Great job ! this is very funny :)

Cheers, FireFox.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#10 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 01 July 2009 - 02:10 AM

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

#11 Randeniya

Randeniya

    Seeker

  • Active Members
  • 12 posts

Posted 14 July 2009 - 10:55 AM

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! :)

#12 monoceres

monoceres

    asdf

  • MVPs
  • 4,020 posts

Posted 14 July 2009 - 11:39 AM

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.

Broken link? PM me and I'll send you the file!


#13 logmein

logmein

    Polymath

  • Active Members
  • PipPipPipPip
  • 214 posts

Posted 15 July 2009 - 02:32 AM

great job!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users