Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss. print.

Steganography is the art of concealing communication. That means we send messages in a non-obvious way for outsiders to others. The receiver from the message knows how to apply the code so they can understand our message. You could use an ad in a newspaper and the letters in the ad could be placed in a way that only insiders can read the true message. Those of you who have seen the marvelous movie: “a brilliant mind” know what I am talking about. Another form is when my wife says to me in public, “Honey, I don’t feel like dancing now” Others would think that she doesn’t feel like dancing, I know she simply is bored with where we are and wants to go home.
Encryption can be used (like in the last example) but is, on the other hand, just a tool for Steganographical communication to hide the messages. The main purpose of Steganography is privacy and secrecy of information in abstract form. This means that any form of messages can be hidden in files where they are expected the least like hidden inside a .BMP, .JPG, .MP3, .AVI, etc. This is likely undetectable since this files are very common tools of our everyday life.

The art
Let’s assume you want to hide the extremely and very important message “Hello” in a graphical file. I first create the file. It contains a picture created with asterisk.

**      * *     **      * **    *   *   *   *   *  *    ***     

As you can see, it is a “B” I created here. A remarkable file indeed. Now let’s assume the bits in the picture are either 0 (off) or 1 (On thus forming the *) and the viewer doesn’t know any other value. I name the file, for the remainder of this article, B.Bmp. The bit wise representation of B.BMP would be like this:

PictureBitwise representation**      11000000* *     10100000**      11000000* **    10110000*   *   10001000*   *   10001000*  *    10010000***     11100000

Knowing the structure of the file we can now embed the word “hello”. First of all we read the file and place the content in a string:

lcFileString = FILETOSTR("B.BMP")

Next we place the word “hello” in that string, point of attention here is that I do not disturb the picture.

lcFileString = SUBSTR(lcFileString, 1, 2) + "hello" + SUBSTR(lcFileString, 8)

Now I save the string to a new file, called "bb.bmp"

STRTOFILE(lcFileString, "bb.bmp")

As said, the viewer only knows about 1 and 0 as on or off so it would still display the B as it has no way to interpret the other bits, however, a hex viewer would show the file like:

Bitwise representation010168656c6c6f000100010000000000010100000000000001000101000000000100000001000000010000000100000001000001000000000101010000000000

68, 65, 6c, 6c, 6f is Hex for "hello", even though you might not have greeted anybody like that it still is true. This way you can send messages to others in a concealed way.

A real life example
Now, I think we all agree that there is not much use for placing the word “hello” in a file. But what about a password. As said before, encryption is a tool within Steganography and not necessarily a must.

Let’s take a real picture and insert the word "foxite". For the purpose of that small exercise I took one familiar picture, that of our site and converted it to a BMP file. It is the foxite8.bmp that you can find in the download that goes with this article. Opening it with “ms paint” gives you the familiar picture:

There is a second bitmap as well, it has the name foxite8_2.bmp, This is what it looks like:

Hmmm, not really a difference is there? However, there is another way to look at it, with the HexEdit that ships with VFP. We type:

DO HOME() + "tools\HexEdit\hexedit.app" 

in the command window. The hexeditor starts, we select the foxite8.bmp and take a look at it

starting the hexeditor a second time and opening the foxite8_2.bmp gives the following result:

Think of the possibilities
This is just a basic example of hiding a message. No encryption is being used. Using encryption and having deeper knowledge of the format of a bitmap (or any other filetype) gives you possibilities unforeseen and only limited by your imagination. For more information on bitmap formats you can visit: http://www.daubnet.com/formats/BMP.html. Stay tuned, there is more to tell about this technique. See you in the next article again.

Download code
Click here to download the code that is discussed in this article. The download is a zipfile. Its size is 242,721 bytes.


Mz David has been programming the Fox since 1999. He graduated as a mathematician in 1996. David's main line of business is POS (Point of Sale) and Inventory Systems. He has developped different POSWares in C, Progress, Delphi, FoxDOS 2.6, Clipper and VFP. David currently is the head of the development department of his company Applied Ideas.


Your Name: 
Your Feedback: 

Spam Protection:
Enter the code shown: