GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing inventwithpython.com — Caesar Hacker BUY THIS BOOK: No Starch Press (free ebook) | Amazon | Barnes and Noble | Powell's | Bookshop.org | Goodreads | Kobo | Thriftbooks
SUPPORT THE AUTHOR: Patreon or Donate Directly
Prev: Caesar Cipher | Next: Calendar Maker
This program can hack messages encrypted with the Caesar cipher from Project 6, even if you don’t know the key. There are only 26 possible keys for the Caesar cipher, so a computer can easily try all possible decryptions and display the results to the user. In cryptography, we call this technique a brute-force attack. If you’d like to learn more about ciphers and code breaking, you can read my book Cracking Codes with Python (No Starch Press, 2018; https://nostarch.com/crackingcodes/). The Program in ActionWhen you run caesarhacker.py, the output will look like this:
How It WorksNote that lines 20 to 36 in this program are nearly identical to lines 55 to 78 in the Caesar cipher program. The hacking program implements the same decryption code, except that it does so in a Unfortunately, the hacking program isn’t sophisticated enough to identify when it has found the correct key. It relies on a human to read the output and identify which decryption produced the original English (or whichever written language was encrypted). Chapter 11 of the book Cracking Codes with Python (No Starch Press, 2018) details how you can write Python code to detect English messages.
After entering the source code and running it a few times, try making experimental changes to it. Keep in mind that the string stored in the Exploring the ProgramTry to find the answers to the following questions. Experiment with some modifications to the code and rerun the program to see what effect the changes have.
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |