Cryptography

Classwork:
Screen Shot 2015-05-14 at 9.26.24 PM
Caesar Cipher
Create a new file in Idle with the following program: cipher.py

Cryptography

The science of writing secret codes is called cryptography.
220px-Lorenz-SZ42-2
German Lorenz cipher machine, used in World War II to encrypt very-high-level general staff messages

In cryptography, we call the message that we want to be secret the plaintext. The plaintext could look like this:

Hello there! The keys to the house are hidden under the flower pot.

How would encrypt it so it would become a secret message?


You can use Idle to answer some of the questions.

1. What is the ASCII table? What is the range of numbers that is used in the table?
2. What is the first number where the alphabet starts? Is it lower case or upper case?
3. How do you get the ASCII value of any letter or number (alphanumeric) in python?
4. How do you get the alphanumeric value of an integer in the range of the ASCII table?
5. Can you print all of the ASCII values?
6. Explain what a cipher is?
7. Run the cipher program and enter this sentence: “Doubts may not be pleasant, but certainty is absurd.” What is the encrypted sentence?
8. What does this ‘Hello’.isalpha() do in python shell?
9. What is the syntax to check if it is numeric?
10. What does this ‘HELLO’.isupper() do in python shell?
11. Explain what this code snippet does and what the purpose is in cipher.py:

if num > ord('Z'):
   num -= 26
elif num < ord('a'):
   num += 26

12. Explain the function getKey().
13. Explain the function getTranslatedMessage(mode, message, key).

Homework
Explain Brute Force