This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Surya shankar
Steganography is the practice (or art) of hiding secret messages in plain view.
Take an image file of a flower, for example. Opening the file shows a flower. Whoopie. However, there might be a hidden message encoded inside the bits and bytes of the image data that is not visible unless certain software is used to decode it.
The same can apply to text files. You could write an innocent readme.txt file that looks like any other text file of instructions when opened normally. With steganography, you could encode a secret message within readme.txt that includes game cheat codes, secret contact information, a cookie recipe, ASCII art, or whatever else you wish to convey to your accomplice who receives the file.
What is steghide ?
steghide is a command line utility available on *nix like platforms. It allows us to hide textual contents inside supported image file.
How to hide text using steghide ?
Let us finally see how we can actually hide our super confidential text using steghide.
First of all create a text file and download an image from an internet.
Text file
Image
Run the command below to encrypt and append the data. You will be asked to type a password twice.
steghide embed -cf <image_file> -ef <file_with_confidential_text>
The -cf option is short for --coverfile which specifies the targeted image file. Whereas the -ef option is short for --embedfile which is the file which needs to be hidden.
Here we successfully hide the text file inside our image.
How to extract hidden text using steghide ?
Now that we have appended our text in the file in the section above. Let us see how we can actually retrieve the file from the image.
Now that we have the file let us run the command below to extract the data from the image file. It will prompt for password which you have used to encrypt the text.
In order to extract the textfile from the image ..
lets delete the original text file first
steghide extract -sf <image_file>
Code language: Bash (bash)
The option -sf is short for --stegfile which is the file which holds the appended data.
We have successfully extracted the encrypted information from the image.
This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Surya shankar
Surya shankar | Sciencx (2022-12-09T19:05:34+00:00) Steganography : Hide text within an Image file using steghide.. Retrieved from https://www.scien.cx/2022/12/09/steganography-hide-text-within-an-image-file-using-steghide/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.