Game Development Reference
In-Depth Information
Topics Covered In This Chapter:
Cryptography and ciphers
Encrypting and decrypting
Ciphertext, plaintext, keys, and symbols
The Caesar Cipher
ASCII ordinal values
The
chr()
and
ord()
functions
The
isalpha()
string method
The
isupper()
and
islower()
string methods
Cryptanalysis
The brute force technique
The program in this chapter is not really a game, but it is fun to play with nonetheless.
Our program will convert normal English into a secret code, and also convert secret codes
back into regular English again. Only someone who is knowledgeable about secret codes
will be able to understand our secret messages.
Because this program manipulates text in order to convert it into secret messages, we
will learn several new functions and methods that come with Python for manipulating
strings. We will also learn how programs can do math with text strings just as it can with
numbers.
About Cryptography
The science of writing secret codes is called
cryptography
. Cryptography has been