Hacking Secret Ciphers with Python

(Ann) #1

70 http://inventwithpython.com/hacking


Email questions to the author: [email protected]


THE CAESAR CIPHER


Topics Covered In This Chapter:
 The import statement
 Constants
 The upper() string method
 for loops
 if, elif, and else statements
 The in and not in operators
 The find() string method


“BIG BROTHER IS WATCHING YOU.”


“1984” by George Orwell

Implementing a Program


In Chapter 1, we used a cipher wheel, a St. Cyr slide, and a chart of letters and numbers to
implement the Caesar cipher. In this chapter, we will use a computer program to implement the
Caesar cipher.


The reverse cipher always encrypts the same way. But the Caesar cipher uses keys, which encrypt
the message in a different way depending on which key is used. The keys for the Caesar cipher

Free download pdf