This instructable is intended to demonstrate practical codes that are many times harder to crack than the codes you normal find in newspapers and puzzle books. This is the real deal - codes that have been used by real-life spies during such high risk times as WWII. These are for a variety of situations, from keeping your club house a secret to keeping your formula for rocket fuel safe.
Listed below is a short glossary of terms, should you need it:
A method of concealment in which entire words or phrases are substituted for other words or phrases. Example: dog = hideout. This means that most of what people call "codes" are not really codes, but ciphers (see below). Everything in this instructable is a cipher, except for the book code as noted in step 4. However, since everyone is used to hearing the word "code," I will use it interchangeably with "cipher" throughout this instructable.
A method of concealment in which individual letters are substituted or transposed (switched around). Example: Agent = tnega (Agent backwards). Pig Latin is also a cipher.
A method of encryption in which the letters in the alphabet are replaced directly. This means that everywhere an S appears in your message, it would be substituted with, for instance, M. This is generally a weak type of encryption.
This means that a letter could have more than one meaning. So every time an S appears in your message, the first time it might get replaced with an E, the next time with a W, then a D, and so on. Every cipher in this instructable is poly-alphabetic.
A key is what is needed to decode a message. It may be a word known only to you and your partner (such as the Playfair cipher in step 2), the settings of rotors for the Enigma machine in step 3, or a title of a book for the book code in step 5
Brute force attack
This is when someone tries to break a code by just trying every single possible combination, one at a time, until they get something that makes sense. The average person can break a mono-alphabetic cipher this way, but anything more complicated will likely need a computer.
Your message before it is encrypted. (readable)
The message after it is encrypted (unreadable)
Step 1: General Rules
It is important that you select a code that is fitting to the situation. When sending secret messages, those that might try to break your code will fall into one of three categories:
A. General population.
This will be 99.9% of everyone you know. Usual, the most difficult type of message this group
can break is a mono-alphabetic (see intro) cipher. This is why this instructable does not give
any mono-alphabetic ciphers - almost everyone can break them! They are included under the
name Cryptograms in many newspapers next to the crosswords.
I have nothing against geeks - I am one. This group is not to be taken lightly. They will
probably know about any type of cipher you are considering, so it is best to make it a difficult
one. They may also have encryption breaking software and be able to use brute force attacks.
If you get on the wrong side of the government, all I can say is good luck. They have seen
every trick, and cracked harder codes than you ever thought of producing. The best policy is
to keep your messages limited to common tasks like keeping the next meeting location
of SSOBACCG (Secret Society Of Boys Against Cootie Covered Girls) a secret.
Here are some general rules to follow that will make any code or cipher more difficult to break:
1. Keep it short.
The longer a message is, the easier it is to break using the frequency
that a letter appears (E is the most common), patterns, and other techniques.
Using abbreviations will also help detour software-based code breaking that
might be checking possible solutions against a dictionary to see if it makes sense.
2. Break coded messages into groups of 4 letters.
This is a technique that has been used by spies for decades. This keeps someone
from guessing a message based on word length (ex: a single letter is either I, a,
and sometimes o) Also, it helps to keep someone decoding the message form
losing their place by having it in manageable chunks. Example: AFRT CGTJ VGTY SFVT.
3. Never send the key with the code.
It might be temping to send the keyword (if you were using the telegraph code, for
example) with the message. However, you should always arrange the keyword ahead
of time or send it in a separate message. If someone has the keyword, it is just a matter
of trying every type of encryption.
4. Change the key often - consider using a one-time pad.
It is important that, if someone does break your code, the knowledge of how to translate it
has a very short life. Change the key as often as practically possible. Every week is good,
certainly not more than every month. A very good idea would be to use a one-time pad of
keys. For example, if you were using the Playfair cipher (Step 3), your one-time pad would
be a list of keywords, and as you sent messages back and forth you would go down the list
using each word only once. Then, the entire sheet would get replaced every so often in
case it was discovered.
5. Use dummy characters.
After you message is encoded, consider throwing in some random characters to make it
harder to crack. The person recipient of message would know to discard, say, the first
and last three characters of the message before decoding.
6. Avoid punctuation.
Punctuation can provide a code breaker with valuable information - for example, sentences
that end with a question mark often start with a W (what, when, where, why).