Cryptography has a long and colorful history from Caesar's encryption in first century BC to the 20th century.
One of the most basic methods of encryption is the use of Caesar Ciphers. It simply consist in shifting the alphabet over a few characters and matching up the letters. This makes transposition and substituting the two major principles in classical cryptography.
Lets look first at transposition, which is the changing in the position of the letters in the message such as a simple writing backwards
Plaintext: THE PANEL IN THE WALL MOVES Encrypted: EHT LENAP NI EHT LLAW SEVOM
or as in a more complex transposition such as:
THEPAN ELINTH EWALLM OVESAA
then take the columns:
TEEO HLWV EIAE PNLS ATLA NHMA
(the extra letters are called space fillers) The idea in transposition is NOT to randomize it but to transform it to something that is not recognizable with a reversible algorithm (an algorithm is just a procedure, reversible so your correspondent can read the message).
The second principle is substitution. That is, substituting a Symbol for a letter of your plaintext (or word or even sentence). Slang even can sometimes be a form of cipher (the symbols replacing your plaintext), ever wonder why your parents never understood you? Slang, though, is not something you would want to store a secret in for a long time. In WWII, there were Navajo CodeTalkers whom passed along info from unit to unit. From what I hear (someone verify this) the Navajo language was a very exclusive almost unknown and unwritten language. So the Japanese were not able to decipher it.
Even though this is a very loose example of substitution, whatever works works. The classical example of a substitution cipher is a shifted alphabet cipher
Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: BCDEFGHIJKLMNOPQRSTUVWXYZA Cipher2: CDEFGHIJKLMNOPQRSTUVWXYZAB etc...
Example:(using cipher 2)
Plaintext: THE PANEL IN THE WALL MOVES Encrypted: VJG RCPGN KP VJG YCNN OQXGU
If this is the first time you've seen this it may seem like a rather secure cipher, but it's not. In fact this by itself is very insecure. For a time in the 1500-1600's this was the most secure (mainly because there were many people who were illiterate) but a man (old what's his name) in the 18th century discovered a way to crack (find the hidden message) of every cipher of this type he discovered frequency analysis.
In the shifted alphabet cipher or any simple randomized cipher, the same letter in the cipher replaces each of the same ones in your message (e.g. 'A' replaces all 'D's in the plaintext, etc.). The weakness is that English uses certain letters more than any other letter in the alphabet. 'E' is the most common, etc. Here's an exercise count all of each letter in this article. You'll find that in the previous sentence there are 2 'H's,7 'E's, 3 'R's, 3 'S's, etc. By far 'E' is the most common letter; here are the other frequencies [Frequency tables|http://rinkworks.com/words/letterfreq.shtml]. Basically you experiment with replacing different symbols with letters (the most common with 'E', etc.).
Encrypted: VJG TCKP KP URCKP
First look for short words with limited choices of words, such as 'KP' this may be at, in, to, or, by, etc. Let us select in. Replace 'K' with 'I' and 'P' with 'N'.
Encrypted: VJG TCIN IN URCIN
Next select VJG this is most likely the (since the huge frequency of 'the' in a normal sentence, check a couple of the preceding sentences).
Encrypted: THE TCIN IN URCIN
generally this in much easier in long messages the plaintext is 'THE RAIN IN SPAIN'
A more secure encryption is a transposed substitution cipher.
Take the above message in encrypted form
Encrypted:VJG RCPGN KP VJG YCNN OQXGU
now spiral transpose it
VJGRC NNOQP CAAXG YUNGN GJVPK
The message starts in the upper right corner and spirals to the center (again the AA is a filler) Now take the columns:
VNCYG JNAUJ GOANV RQXGP CPGNK
Now this is more resistant to Frequency analysis, see what we did before that started recognizable patterns results in:
TNCYE HNAUH EOANT RQXEN CNENK
A problem for people who crack codes.