Game Development Reference
In-Depth Information
used for thousands of years to send secret messages that only the recipient could
understand, even if someone captured the messenger and read the coded message. A secret
code system is called a cipher . There are thousands of different ciphers that have been
used, each using different techniques to keep the messages a secret.
In cryptography, we call the message that we want to be secret the plaintext . The
plaintext could look something like this:
Hello there! The keys to the house are hidden under the
reddish flower pot.
When we convert the plaintext into the encoded message, we call this encrypting the
plaintext. The plaintext is encrypted into the ciphertext . The ciphertext looks like random
letters (also called garbage data ), and we cannot understand what the original plaintext
was by just looking at the ciphertext. Here is an example of some ciphertext:
Ckkz fkx kj becqnejc kqp pdeo oaynap iaoowca!
But if we know about the cipher used to encrypt the message, we can decrypt the
ciphertext back to the plaintext. (Decryption is the opposite of encryption.)
Many ciphers also use keys. Keys are secret values that let you decrypt ciphertext that
was encrypted using a specific cipher. Think of the cipher as being like a door lock.
Although all the door locks of the same type are built the same, but a particular lock will
only unlock if you have the key made for that lock.
The Caesar Cipher
When we encrypt a
message using a cipher,
we will choose the key
that is used to encrypt and
decrypt this message. The
key for our Caesar Cipher
will be a number from 1 to
26. Unless you know the
key (that is, know the
number), you will not be
able to decrypt the
encrypted message.
Figure 14-1: Shifting over letters by three spaces. Here, B becomes E.
The Caesar Cipher was one of the earliest ciphers ever invented. In this cipher, you
encrypt a message by taking each letter in the message (in cryptography, these letters are
called symbols because they can be letters, numbers, or any other sign) and replacing it
with a "shifted" letter. If you shift the letter A by one space, you get the letter B. If you shift
the letter A by two spaces, you get the letter C. Figure 14-1 is a picture of some letters
shifted over by 3 spaces.
Search WWH ::




Custom Search