How to Obfuscate Messages with Steganography

By | January 27, 2016

steganography example file
Steganography is the practice of hiding a message within a message. Obfuscation is the act of obscuring information or messages.

ob·fus·cat·ed, ob·fus·cat·ing transitive verb :

1  a : darken

    b : to make obscure <obfuscate the issue>

2 : confuse <obfuscate the reader>

intransitive verb : to be evasive, unclear, or confusing

  • ob·fus·ca·tion – \ˌäb-(ˌ)fəs-ˈkā-shən\ noun

  • ob·fus·ca·to·ry – \äb-ˈfəs-kə-ˌtȯr-ē, əb-\ adjective

Merriam-Webster page

Steganography is a way to obfuscate information. Similar to the field of cryptography, steganography is different in that it does not necessarily rely on mathematical or algorithmic manipulations to create or decipher a message. For example, the Wikipedia page I linked earlier contains these images:

steganography example

Main image file that “holds” a hidden file.

steganography hidden message

Hidden image, after two operations are done.

The image on the left is the original picture, which you could send without drawing any attention. The picture on the right is obtained by “by removing all but the two least significant bits of each color component and a subsequent normalization.” Walla, you now have a cat picture, a commodity in high demand on the internet. The cat picture had to be added into the picture on the left. Doing the special operation(s) on an ordinary picture will, unsurprisingly, just end up in a lot of noise.

This can be done very simply, actually. It’s so easy, I’d like to do an example right now. But first, it might be useful to become familiar with the command line, if not you can always just copy/paste my example, do whatever suits you at the moment:

Previously, I created an introduction, “Fear Not The Command Line” to the command line, followed by part 2 where some basic usages of the command line are covered. These tutorials should give you a basic understanding of the command line and how it works. Now, I would like to take you a little further – a little bit deeper and closer to the files that are a part of your everyday life. Let’s take a look at how we can hide a file inside another image file that ends with .jpg or .png. The image will appear the same, but increase in size. For now, we will do this in Windows. Open cmd.exe.

Get a file, any file, that you want to hide (not too large now) and an image file. Put these in the same directory, somewhere you can easily navigate to (your desktop). Put the file you want to hide into a new folder and name it something like “hideMe”, then right click that folder and select “Add to archive…” Use the default values. This method works similarly with winRAR, but I successfully tested it with 7zip. Next, go to the command line and change directory (‘cd’) to where the files are (your desktop) and type these commands:

  • copy /B examplePicture.png + picWithHiddenFile.png

Note: If examplePicture is a .png, the output file (picWithHiddenFile) must be .png as well.

The prompt should say “1 file(s) copied.”, congratulations, that is it! To look and see the hidden file inside the picture, just right click the output file and select “Open with…”, then choose 7zip file manager and it should display whatever file you made a zip archive of earlier ( in the explorer with the file right there. Additionally, you can filter out the hidden zip archive with a command like this:

  • ren picWithHiddenFile.png

And then you’ll be able to right click and open with 7zip file manager just like before. The “ren” command is short for rename and essentially just reveals the hidden file, or “grabs” the zip file from the container image. You’ll lose “picWithHiddenFile.png” this way, though. Congratulations, you just obfuscated and extracted your first hidden message. You should just now be realizing how much fun you can have with this new knowledge!

What’s next?

I would like to learn and post the equivalent method for the Linux bash shell, or review available applications that assist in these types of tasks. I know there are some free applications available, though I have not tried them out. I would also like to know if various types of compressed files can be obfuscated in the same way. What about you, the reader? If you’ve made it this far, you should comment or send me an email! You tell me what you want! And now, for a completely out of context and meaningless picture of a river:

completely meaningless picture



One thought on “How to Obfuscate Messages with Steganography

  1. Pingback: Cryptographic Principles – Sandra Czernik

Leave a Reply

Your email address will not be published.