Encryption
Encryption is a way of hiding information. For example, when you buy something online, it is very important that information (such as credit card numbers) remain private. This is done by encoding the information in such a way that only the intended recipient can decode it. The idea is simple, although the implementation can be very difficult.
Caesar Cipher
One of the simplest forms of encryption is called the Caesar Cipher. It is not at all secure, but it is a great way to understand the concept of encryption. To encode something in Caesar Cipher, just move every letter in your message over by a set number of letters. For example, let's encode the message "ATTACK AT DAWN" by shifting it one letter. The result is "BUUTDL BU EBXO." The message recipient would shift each letter one space in the opposite direction to produce the original message.
In this case, both parties must have some shared information - the number of letters to shift the message. This shared information is called a KEY. The critical flaw in Caesar Cipher is that there are only a small number of keys. You can only shift the alphabet to 25 different values, so there are only 25 keys. It is very easy to crack this sort of cipher just by trying every combination of keys.
Here's a sample you can crack:
"Wkh lqwhuqhw zdv qhyhu ghvljqhg wr eh vhfxuh. Wkh lqwhuqhw zdv ghvljqhg wr pryh slfwxuhv ri fdwv." Gdq Ndplqvnb
Other Substitution Ciphers
Caesar Cipher is the simplest example of a substitution cipher - where one letter or symbol is substituted for another. A slightly more challenging method of encryption would be for each letter to correspond to another, random letter. For example, the unencrypted (also called "clear text" or "plain text") "A" might correspond to the encrypted ("cyphertext") "Q."
Here's an example. If the plaintext alphabet is abcdefghijklmnopqrstuvwxyz, and the ciphertext alphabet is QWERTYUIOPASDFGHJKLZXCVBNM, see if you can decode the message below:
RG FGZIOFU LTEKTZSN; YGK ZODT LTTL QFR ITQKL QSS ZIOFUL, QFR ROLESGLTL QSS. - LGHIGESTL
Other well-known substitution ciphers include the pigpen cipher and dancing men cipher. These simple substitution ciphers are very easy to crack with some practice, so they were replaced with more complex types, including the nearly-unbreakable Enigma and the unbreakable one-time pad. However, all substitution ciphers share one short-coming: both the send and recipient must share the same key before a message can be exchanged.
Public Key Encryption
Public key encryption was invented to solve the problem of encrypting messages between two parties who have never shared a key, such as in an online transaction. It relies on special key pairs, each of which an decode messages encrypted with the other. One key is kept private (the "private key"), and one is made public to everyone (the "public key"). For example, Alice wants to send Bob a secure message. Alice looks up Bob's public key, and uses that to encrypt the message. When Bob receives the message, he decodes it with his private key.
This method is even more useful, however. Alice and Bob are worried there may be an eavesdropper, Eve, who wants to create mischief. Eve could send Bob a message that pretends to come from Alice. This could cause big trouble! So when Alice sends Bob a message, she also encrypts the message with her own private key. If Bob can decode the message with Alice's public key, he knows for sure that Alice sent the message! So if Alice encrypts her message with both her private key and Bob's public key, her message will only be readable by Bob AND Bob will know the message definitely came from her.
This is the technology that is used to keep online messages secure. You can tell when it is use in a browser by looking for "https://" or a lock symbol in the address bar.