Thursday, December 01, 2011

How to create an impossible to decrypt cipher

Pretty simple stuff.

First, go out and download 99 text files from some site like Gutenberg.org. Make them all under about 100,000 words. There are many books with around 80,000 words and some with more.

Now write a note to someone.

At the beginning of the note place a two digit number which identifies the text file.

Now create a program which converts each letter into a number like 00048203. The first six numbers identify the word in the text file. Five is enough if you kept the text files under 99,999 words. The next two numbers identify the letter in the word.

The same number is not used twice. If a letter appears a second time it will be taken from a different word.

If you want to get really tricky and overly complex, write the program so it changes the word count. For example word 482 might not be word 482, maybe the program only uses every other word or every third word or maybe it rotates the usage based on the identifying number of the text file, for example text file 99 always uses the 9th word. Maybe a number is added with the text file, 08199 for example, and the second number of the first three identifies the word skip pattern, maybe the first or third or maybe the square root of the number of maybe the number is divided by the second number from the text file number. With 08123, the 81 could be divided by the 3 from text file number which gives me 27 and I just use every seventh word.

This is actually a pretty simple program to write, not that I would ever admit to writing this program or using it. If I did it, the program would actually take an extra step of hiding the numerical message inside of an image.

Rename the program to something that is normal on your computer and drop it into the correct directory. I could have renamed mine "notepad.exe" and made it so it only worked as an encryption/decryption program when you ran it from a DOS prompt with an option. Otherwise it just looked like Windows Notepad.

I could then send the image to someone who had the program and the exact same 99 text files.

Every so often I could change the 99 text files and bingo, we have an encryption package that is impossible to break, unless someone manages to get both the program and the correct 99 text files.

If you do something like this, downloading the files from a place like Gutenberg.org. Change the number of words in the beginning of your text file, add or subtract something that is unlikely to be noticed without a direct file to file comparison. Zip all the text files into one zip file and upload it to a server or distribute a CD by hand or snail mail.

You want to make sure that all the files are exactly the same and are not changed by anyone during the time you are using this system of encryption.

Swap the text files around every so often.

This encryption can be used in e-mail, chat rooms, forums, hidden messages, etc.

There are other forms of less secure encryption that can be used more easily.

This encryption can only be broken if someone has both the program (or processing pattern) and the currently used text files.

You can do this by hand also, although that is not quite as much fun.

One of the conspiracy theories I have heard is that Gideon's Bibles were placed in hotel rooms to make sure U.S. Spys had "the book" they needed to decrypt notes they received. Truthfully, if I was a "Russian Spy" it would probably be the first book I checked so I don't think that works very well.

This method can be used with any King James Version of the Bible (almost, sometimes the wording changes). There are 66 books so the first two numbers are between 01 and 66. The second three numbers are the chapters. The next three numbers are the word. The last two numbers are the letter. (If you go to letter, maybe you just stick with words :-). 32003102 is "the" and 3200310203 is "e".

The individual books of the Bible from Gutenberg.org have kewl scripture numbers 32:003:005 that can convert into 32003005023 or 3200300502303. Have to love those scripture numbers.

Want to get really wacked? Convert the number into binary. You could convert the binary into words like "on" and "off" or "true" and "false". So the number one becomes 00110001 and then becomes truetruefalsefalsetruetruetruefalse. Yeah, I reversed it for another level of confusion. This makes a simple message into a huge monster of text that can cause any overworked geek's eyes to just glaze over and any computer to spit it out as gibberish.

Using the Bible for this stuff is pretty common though and someone could break your code pretty quickly.

So if you are a script kiddie looking to learn and use an easy method of encryption with your buddies or an international beanie baby smuggling ring or just a group of people who hate the idea of someone eves dropping on your conversation's write yourself up a program or get a geek friend to write yourself up a program. Just be careful you don't break any laws about writing computer ciphers.

2 comments:

max said...

Thanks for that! But I think it's unnecessarily complex. I mean, we aren't all wanted men or spies.

John D. Ayer said...

Your assumption is that only spies or wanted people are interested in privacy. Privacy is a huge consideration. Insider trading is huge and the interception of corporate communications is a prime target of Ninja hackers. There are a lot of lammers out there hacking the average joe's PC. Those guys are losers. Some noobs hack credit cards. Still lame. Hacking insider corporate information is the schnitz for hacking. Ninja's do it without leaving a trace and then they buy and sell stocks based on the information. This is one example of the legitimate use of encryption. Another example is people in censored nations who want to communicate to the outside world, China to the US for example. Other examples include normal people who don't like everyone in their business. The idea that honest people don't have anything to hide is crap propaganda spread by totalitarians.