I found this new technique yesterday. Many of you might be knowing this already. But still I thought it is worth to write about it.
So what the heck is Steganography? According to Wikipedia
“Steganography is the art and science of writing hidden messages in such a way that no one apart from the intended recipient knows of the existence of the message; this is in contrast to cryptography, where the existence of the message itself is not disguised, but the content is obscured.“
Remember the good old days when you used to write invisible messages on paper using lime juice? Yes, this is the modern version of the same technique.
There are several methods for hiding data within files. One method is to alter the covering image bits and storing the secret file contents within the least significant bits of the covering image. More information on this method can be found on the Wikipedia page on Steganography. This affects the covering image quality (though the changes are usually undetectable).
The second method, which we are dealing with here is appending the contents of the secret file at the end of the JPEG file. In this method, the quality of the original image is not compromised. The simplest method for doing this is using the command copy in Windows and cat in Linux / Mac.
On windows, open the command prompt (Start Menu > Run > cmd) and type
copy /b cover_image.jpg + secret.zip output_file.jpg
On Linux / Mac systems run the following command in your terminal window
cat cover_image.jpg secret.zip >> output_file.jpg
Where cover_image.jpg is the JPEG file used to cover the secret file
secret.zip is the archive whose content is to be protected
output_file.jpg is the protected file having the contents of secret.zip hidden within cover_image.jpg
If you wish to incorporate extra protection to the hidden file, then don’t forget to password protect the archive before hiding.
Now that you have stored the files, how do you retrieve it? Unfortunately, not all compression and archiving softwares support these archives. Fortunately, WinRAR and 7-Zip, two popular compression utilities supports these files. Depending on your system, the extract option may or may not be available on the Explorer right click context menu of the output image file (It is not shown in my system, while it is being shown in my friend’s system). If it is not shown, then do one of the following
- Change the output file extension to .zip from .jpg and extract the files or
- Open either WinRAR or 7-Zip and browse open the output image
PHP programmers interested in Steganography please check the Stegger library at PHPClasses.
Comments are closed.