Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you hide information inside a jpg or gif photo?

How can I write some information inside a photo file like jpg or gif without destroying the image? and of course without showing it on the photo since the whole idea is to send information in the file of photo undetected by anyone (to provide security/privacy to some extent)!

like image 346
M. A. Kishawy Avatar asked Aug 01 '09 08:08

M. A. Kishawy


3 Answers

You can concatenate a gif and a zip (the information you want to hide) into one file. Gifs are read from the start of the file, while zips are read from the end of the file.

To create such a file in linux:

$ cat file1.gif >> outfile.gif
$ cat file2.zip >> outfile.gif

The resulting file should have the size of file1.gif and file2.zip together and should be openable by any gif viewer and zip file handler.

like image 105
Maik Avatar answered Dec 07 '22 23:12

Maik


I'm sure there are many ways. Here's one:

In a photograph, minor variations in color would often be unnoticable to the naked eye, or even if noticed, might easily be mistaken for flaws in the quality of the picture.

So to take a simple example, suppose you had a gray-scale GIF image where the pallette is arranged in order from white to black with a smooth range of grays in between. I'm not sure how much you know about graphic file formats, but in GIF you have one byte per pixel, with each possible byte value mapping to some specific color. So in this case we could say pallette #0=RGB(0,0,0), pallette #1=RGB(1,1,1), ... palette #255=RGB(255,255,255).

Then you take an ordinary, real photograph. Break your secret message into individual bits. Set the last bit of each pallette index number to successive bits of your message.

For example, suppose the first eight pixels of the original photo are, say, 01 00 C9 FF FF C8 42 43. Your message begins with the letter "C", ascii code 0110 0111. So you change the last bit of the first byte to 0, changing the byte from 01 to 00. You change the last bit of the second byte to 1, changing the byte from 00 to 01. You change the last bit of the third byte to 1. It's already 1, so that makes no difference. Etc. You end up with the coded 8 bytes being 00 01 C9 FE FF C9 43 43.

The changes to the colors would be so subtle that it's unlikely that anyone looking at the picture would notice. Even if they did notice, unless they had a reason to be suspicious, they would likely just conclude that the picture was of less-than-perfect quality.

Of course nothing says you have to use 1 bit per byte for the secret message. Depending on how much degradation in quality you think you can get away with, you could use 2 bits per byte, or just change 1 bit in every other byte, etc.

Of course the same technique can be used with color photos: change the last bit in each of the RGB components to encode 3 bits per pixel, etc.

like image 42
Jay Avatar answered Dec 08 '22 01:12

Jay


Hey that method is called as Steganography. With that we can hide messages in not just images but also in audio,vedeo and other formats.

Here is an opensouce Steganography software called steganotool This project is an open source steganography tool that can be used to hide and extract text to/ from Bitmap images.

About Steganography Mediums

Steganography in images

This type of steganography is very effective against discovery and can serve a variety of purposes. These purposes can include authentication, concealing of messages, and transmission of encryption keys. The most effective method for this type of steganography is normally the least significant bit method. This simply means that the hidden message will alter the last bit of a byte in a picture. By altering that last bit, there will be relatively no change to the color of that pixel within the carrier image. This keeps the message from being easily detected. The best type of image file to hide information inside of is a 24 bit Bitmap. This is due the large file size and high quality.

Steganography in Audio

In audio files, the most prominent method for concealing information is the low bit encoding method. The low bit encoding method is somewhat similar to the least significant bit method used in image files. The secret information is attached to the end of the file. One of the issues with low bit encoding is that it can be noticeable to the human ear. If someone is trying to hide information, this could be risky, since it is so easily detectable. The spread spectrum method is another method that has been used in the concealment of information in audio files. What this method does, is it adds random noise to the audio broadcast. This method enables for the information to be spread accross the frequency spectrum and remain hiddden under the random noise. The last method seen in audio steganography is echo hiding data. This method seeks to hide information by using the echos that occur naturally within sound files. Then, extra sound can be added to these echos, extra sound being the concealed message. This is a sufficient way to hide information, expecially since it even improves the sound of the original audio file in some cases.

Steganography In Video

Steganography in Videos is basically hiding of information in each frame of video. Only a small amount of information is hidden inside of video it generally isn’t noticeable at all, however the more information that is hidden the more noticeable it will become. This method is effective as well, but must be done right or else reveal more information instead of hiding.

Steganography In Documents

This is basically adding white space and tabs to the ends of the lines of a document. This type of Steganography is extremely effective, because the use white space and tabs is not visible to the human eye in most text/document editors.

You can also refer to this open source project

This article can be very useful.

like image 45
Arjun Sunil Kumar Avatar answered Dec 08 '22 00:12

Arjun Sunil Kumar