Source Code
Download
Zip file of source code for all programs.
pyperclip.py (A module that adds clipboard copy/paste functions, imported by many of the book's programs.)
Chapter 4, Strings and Writing Programs
Chapter 5, The Reverse Cipher
Chapter 6, The Caesar Cipher
Chapter 7, Hacking the Caesar Cipher with the Brute Force Technique
Chapter 8, The Transposition Cipher, Encrypting
Chapter 9, The Transposition Cipher, Decrypting
Chapter 10, Programming a Program to Test Our Program
Chapter 11, Encrypting and Decrypting Files
Chapter 12, Detecting English Programmatically
Chapter 13, Hacking the Transposition Cipher
Chapter 14, Modular Arithmetic and the Multiplicative Cipher
Chapter 15, The Affine Cipher
Chapter 16, Hacking the Affine Cipher
Chapter 17, The Simple Substitution Cipher
Chapter 18, Hacking the Simple Substitution Cipher
Chapter 19, The Vigenère Cipher
Chapter 20, Frequency Analysis
Chapter 21, Hacking the Vigenère Cipher
Chapter 23, Finding Prime Numbers
Chapter 24, Public Key Cryptography and the RSA Cipher
Copy and Paste
You can also select the text of the source code below, and copy & paste the code into IDLE.
(Click on the text field, then press Ctrl-C to copy.)