View Single Post
07-26-07, 11:51 AM   #10
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
About the video above:
I'll explain a bit what he does here and why it's far from the best way to hide something in an image (even if it might be the easiest one):

- He has 2 files, an image, and what he wants to hide in it.
- He creates a new "secret" file that is nothing more than the second file copied at the end of the first file.
- His jpg viewer ignores the 2nd part of the file because he has read a valid jpg file first and won't just unload it because the end of the file is corrupted. A different viewer would maybe show a warning. Most wouldn't, though.
- His archive extractor does the opposite, ignoring the beginning of the file while looking for a "header" that tells him what kind of archive he's going to extract.

The thing is that you haven't really hidden anything. Your archive appears as well as a normal archive here, just shifted a bit. Anyone can use his software and see your archive. The real nice way to hide stuff into image is something called Steganography. It is a process I have "discovered" by myself when thinking about good alternatives to cryptography, and when I told friends about it, they answered it already existed and was something in the base knowledge of cryptographers
I couldn't find a good site to explain what it is, but the base idea is the following:

A bmp image is a succession of byte (one byte is 8 bits, one bit is a 0 or a 1). One byte allows you to code an integer between 0 and 255 by reading the successions of the 8 bits as a number in base 2:
Code:
00000000 = 0
00000001 = 1
00000010 = 2
00000011 = 3
00000100 = 4
...
11111110 = 254
11111111 = 255
In a simplified black and white format, each pixel of the image is represented by 1 byte which describes its luminosity (255 would be white, 127 would be an average gray, 0 would be black).
The thing is that the last bit of this byte doesn't really matter. If you change your image and sets all the last bits of each byte to 0 for instance, that will just change every pixel's value to the closest even number below it: 245 would be 244, 123 would be 122, 36 would remain unchanged). People wouldn't notice the difference.
So those last bits of each bytes can be used to store something else.

Code:
Let's say you have an image of 10 pixels, which are:
227 178 234 023 139 141 149 071 088 253

You cut the last bit of each byte:
226 178 234 022 138 140 148 070 088 252
You wonna add the following hidden message: the letter "A".
This letter is coded by the number 65 in the ASCII table ( http://www.asciitable.com/ )

Code:
65 is coded by the following sequence of bits: 
0 1 0 0 0 0 0 1

Let's add this to the modified picture above:
226 179 234 022 138 140 148 070 088 253
This new picure looks very close to the original one, but by checking for each byte if it's even or odd and putting a 0 and a 1 in your decrypting message, you can recompose the byte 01000001, which is the "A" character.


This method can be coupled with encryption systems so that it is harder to use statistical methods such as entropy ones (cf wikipedia if you wonna push it a bit ^^) to make it harder for people to know that a message is hidden. You can also take 2 bits instead of 1 to send bigger messages (with the method I described, a file of 1 Mo that you want to hide must be hidden in an image of at least 8 Mo...).


This process can be coded in like 30 lines of C code, so it's really nothing hard. Though there is probably no really googleable soft that does that, as people who know about it and might wonna use it can most likely code it by themselves using the exact method they want
  Reply With Quote