Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you hide data in text?

I wish to put some text on a page and hide some data in that text. Does anybody know of any methods / patterns that have been used in the past to solve this problem?

Example: I have the following text: "The cat sat on the dog and was happy."

I also have the number 123. I want to hide this number in that sentence such that the sentence can be placed on a web page and only someone in the know would be able to find the data.

like image 843
Guy Avatar asked Dec 06 '08 00:12

Guy


People also ask

How do you hide data in a secret text file compartment?

Hiding Data in a Secret Compartment You can use anything after the colon as a secret word, the key is that there can't be any spaces between the first filename and the colon. If you didn't specify . txt on the end, Notepad will automatically add it, and ask if you want to create a new file, even if SomeFile.

How do I disguise a file?

To hide a file or folder on Windows, open a Windows Explorer or File Explorer window and locate the file or folder you want to hide. Right-click it and select Properties. Enable the Hidden checkbox on the General pane of the Properties window. Click OK or Apply and your file or folder will be hidden.


5 Answers

Of course this can be done.

What you are describing is in a broad description called Steganography.

For instance, you might encode a number in such a way that you count the number of words until you see the letter B, in which case 123 could be encoded as:

You belong to the beautiful group of people being elite.

The thing is, the person wanting to decode your message must know your algorithm.

Edit I notice that my numbers are off by one. Start counting at 0 and you'll see the number 123.

like image 111
Lasse V. Karlsen Avatar answered Oct 05 '22 05:10

Lasse V. Karlsen


HTML makes it quite easy to do this, actually. No need for really cunning amounts of steganography, etc. Let's see:

This sentence embeds 123 and then stops embedding.

This sentence embeds 0102 and then stops embedding.

(We'll have to see whether it actually works in markdown, but I suspect so.) Admittedly it's pretty obvious if you know that there's something to look for, but I think you'll agree it's not obvious to casual observers.

I've left it as a little puzzle to work out the scheme, but add a comment if you want it to be explicitly explained.

like image 32
Jon Skeet Avatar answered Oct 05 '22 07:10

Jon Skeet


There are very complicated approaches to this problem, however you can probably go with a very simple one. E.g. define an adjective for every number:

0. beautiful
1. harmless
2. evil
3. colorful
4. weird

and so on. Now select sentences of your choice and put place holders into the sentences where adjectives belong.

"The {adj} cat sat on the {adj} dog and the {adj} cat was happy."

Your number is 123, so your sentence is

"The harmless cat sat on the evil dog and the colorful cat was happy."

A parser can easily take the sentence, split it up into words, find adjectives on the table above, and convert them back to numbers.

The -> ?
harmless -> 1
cat -> ?
sat -> ?
on -> ?
the -> ?
evil -> 2
:

at the end you have 123 again.

As soon people know that there is information hidden in the sentence, the algorithm is easily broken. You can make it harder to break if you add variation by defining multiple adjectives per number. Instead of

1. harmless

you can define

1. harmless/stupid/blue/fashionable

when you need to encode 1, randomly pick any of the words above. As these all map to the number 1, the reverse parser won't care which of the words is printed there, the result will always be one. This randomization will make it harder to reverse engineer the algorithm.

like image 30
Mecki Avatar answered Oct 05 '22 07:10

Mecki


I think at a high level what you are talking about is steganography. http://en.wikipedia.org/wiki/Steganography

The section on modern techniques should get you started: http://en.wikipedia.org/wiki/Steganography#Modern_steganographic_techniques

like image 34
torial Avatar answered Oct 05 '22 05:10

torial


I think what you're looking for is something called Steganography. Corinna John has an excellent collection of articles on the subject up on CodeProject.

http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=475133

like image 33
Jeremy Wiebe Avatar answered Oct 05 '22 07:10

Jeremy Wiebe