Tuesday, February 10, 2009

Embedding a picture into an 8 byte file



Can we embedd a image file to a 1 kb text file?? isn't possible?? let us check it out

Follow the steps:

1.Open up the command prompt. You can do this by going to Start -> Run. Type in "cmd".

2.First thing to do is simply to create a text file using Notepad. In the command prompt, type "notepad test.txt". Notepad will ask you whether you wish to create test.txt. Click yes. Type in "3.141592" and save the file.

3.If you look at the file in Windows Explorer or command prompt, you will see that it is 8 bytes.

4.Now we need an image. Save the Google logo to your hard drive in the same folder as test.txt. Call it test.gif. Windows Explorer and the command prompt should report the test.gif file being 8,558 bytes large.

5.Now we need to embed the image into the text file we created. Type in "type test.gif > test.txt:rw".

6.Delete test.gif since it is now embedded in the text file.

7.Using Windows Explorer or the Command Prompt, ensure that test.txt is still 8 bytes.

8.An image couldn’t have possibly been embedded in the file you may ask. Don’t believe it? Type in "mspaint test.txt:rw". Microsoft Paint should now open up with the logo you embedded into test.txt.

So where have the 8,558 bytes disappeared? How can we store an 8,558 byte image in an 8 byte text file? How has the 8,558 byte image effectively become zero bytes?

do you know the mystery behind it..?

1 comment:

Sam said...

This is due to Windows "Alternate Data Streams" [ADS]

check the link: http://www.windowsecurity.com/articles/Alternate_Data_Streams.html

--
Sam