Did you ever get into (a lot of) trouble because someone found some information on your computer they should not have? Want to hide sensitive information from spying eyes? Here’s the best way to deceive all such nosy people away.
An image file like JPG is read from the beginning of the file and terminated with an ‘End of Image’ marker. An archive file like ZIP has its metadata stored at the end of the file. Put them together and the image will be read as a valid image file and the appended ZIP file will be read as an archive. As easy as that. How to do it? Simple…
Get an image file and an archive of the files that you want to hide. I take image.jpg and filesToHide.zip file. Now you have to create a file that has the contents of the image, the end of image marker followed by the zip archive. To create the archive-image file, run this command:
cat image.jpg filesToHide.zip > hidden.jpg
What this does is the ‘cat‘ command reads the image file first, then reads the zip file and puts them together in the file named hidden.jpg. This command can also be used to create iso images. I will write about it on some other day…
This ‘might’ sometimes go wrong, so, to test the integrity of the image file, try this:
#unzip -t hidden.jpg
warning [hidden.jpg]: 2331 extra bytes at beginning or within zipfile
(attempting to process anyway)
testing: filesFromArchive.zip OK
No errors detected in compressed data of hidden.jpg.
Notice the warning message? The test saw that there were few bytes at the beginning, which means it saw the image file first but the archive is intact and no errors were found. The zip file metadata ignores the image and the image file ignores the zip archive.