"Hacking Secret Ciphers with Python" Released
Mon 15 April 2013 Al Sweigart
My third book, Hacking Secret Ciphers with Python, is finished. It is free to download under a Creative Commons license, and available for purchase as a physical book on Amazon for $25 (which qualifies it for free shipping). This book is aimed at people who have no experience programming or with cryptography. The book goes through writing Python programs that not only implement several ciphers but also can hack these ciphers.

- Download PDF of Hacking Secret Ciphers with Python
- View HTML version online.
- Buy a physical book on Amazon
100% of the proceeds from the book sales will be donated to the Electronic Frontier Foundation, Creative Commons, and The Tor Project.
Each chapter presents a new program and explains how the source code works. At the same time, various ciphers and cryptography concepts are explored. This book covers:
- The Caesar cipher (and how to hack it)
- The Transposition cipher (and how to hack it)
- Writing programs to automatically test our programs
- Encrypting files
- Programmatically detecting English
- The Simple substitution cipher (and how to hack it)
- Modular arithmetic
- The Multiplicative cipher (and how to hack it)
- The Affine cipher (and how to hack it)
- The Simple substitution cipher (and how to hack it)
- The Vigenere cipher (and how to hack it)
- Frequency analysis
- One-time pads
- Generating prime numbers that are hundreds of digits long
- Public key cryptography and the RSA cipher
I first started this book two years ago. The Word doc calculates my editing time for the file at 85,860 minutes (not including the time to write and debug the programs). The book is over 400 pages long with over 1700 lines of code written for the programs (not including whitespace and comments).
The book's website is at http://inventwithpython.com/hacking
Feel free to email me questions or comments at [email protected] or leave a comment below.