-
What’s it about?
A hands-on guide to learning Python programming through creating and breaking ciphers for encrypting secret messages, covering classical to modern cryptography techniques.
Buy New
-44%
$22.30$22.30
FREE delivery Sunday, May 24 on orders shipped by Amazon over $35
Ships from: Amazon.com Sold by: Amazon.com
Learn more
Used - Very Good
$9.05$9.05
FREE delivery May 28 - June 1
Ships from: ThriftBooks-Baltimore Sold by: ThriftBooks-Baltimore
Book details
- ISBN-101593278225
- ISBN-13978-1593278229
- EditionIllustrated
- PublisherNo Starch Press
- Publication dateJanuary 23, 2018
- LanguageEnglish
- Dimensions7.05 x 0.94 x 9.25 inches
- Print length416 pages
After a crash course in Python programming basics, you’ll learn to make, test, and hack programs that encrypt text with classical ciphers like the transposition cipher and Vigenère cipher. You’ll begin with simple programs for the reverse and Caesar ciphers and then work your way up to public key cryptography, the type of encryption used to secure today’s online transactions, including digital signatures, email, and Bitcoin.
Each program includes the full code and a line-by-line explanation of how things work. By the end of the book, you’ll have learned how to code in Python and you’ll have the clever programs to prove it!
You’ll also learn how to:
- Combine loops, variables, and flow control statements into real working programs
- Use dictionary files to instantly detect whether decrypted messages are valid English or gibberish
- Create test programs to make sure that your code encrypts and decrypts correctly
- Code (and hack!) a working example of the affine cipher, which uses modular arithmetic to encrypt a message
- Break ciphers with techniques such as brute-force and frequency analysis
There’s no better way to learn to code than to play with real programs. Cracking Codes with Python makes the learning fun!
Review
—Ray Doyle, The Ethical Hacker Network
“I recommend this book for anyone who wants to learn Python/programming and is interested in security or puzzles.”
—Jeanne Boyarsky, Code Ranch
“A fantastic programming and cryptography course for any high school-aged child.”
—The Old Schoolhouse Magazine
About the Author
About the author
Follow authors to get new release updates, plus improved recommendations.Al Sweigart is a software developer and tech book author living in Houston. He has written several programming books for beginners, including Automate the Boring Stuff with Python. His books are freely available under a Creative Commons license at his website https://inventwithpython.com.
Frequently bought together
Frequently bought together

You might also like
-  
-  
-  
-  
-  
-  
Customers who bought this item also bought
You might also like
-  
-  
-  
-  
-  
Features & details
Features
- Book - cracking codes with python: an introduction to building and breaking ciphers
- Language: english
- Binding: paperback
Product information
| ASIN | 1593278225 |
| Publisher | No Starch Press |
| Publication date | January 23, 2018 |
| Edition | Illustrated |
| Language | English |
| Print length | 416 pages |
| ISBN-10 | 1593278225 |
| ISBN-13 | 978-1593278229 |
| Item Weight | 1.75 pounds |
| Reading age | 12 years and up |
| Dimensions | 7.05 x 0.94 x 9.25 inches |
| Best Sellers Rank |
|
|---|---|
| Customer Reviews | 4.7 out of 5 stars 397Reviews |
Related books
Customers say
Generated from the text of customer reviewsSelect to learn more
Reviews with images
Submit a report
- Harassment, profanity
- Spam, advertisement, promotions
- Given in exchange for cash, discounts
Sorry, there was an error
Please try again later.Top reviews from the United States
- 5 out of 5 starsVerified Purchase
An excellent book of Python exercises and basic cryptography primer!
Reviewed in the United States on September 25, 2018Format: PaperbackFull Disclosure: I solicited Mr. Sweigart for an eBook copy of this book for review purposes. This was AFTER purchasing the original Hacking Secret Ciphers book for Python 2 around 3 years ago and AFTER purchasing a physical copy of Cracking Codes immediately upon release based solely on my love for the previous installment. If it makes you feel any better, he got me the eBook months ago, and I'm dreadfully late on my review.
I'm a huge fan of Mr. Sweigart's work. I found Hacking Secret Ciphers to be a brilliant primer on basic Python programming practices, and find that it has only been refined and updated in Cracking Codes. Many friends have expressed an interest in what I do and asked me where to begin to learn programming concepts, and I frequently point them toward Python and Mr. Sweigart's resources.
Cracking Codes walks you through several different methods of encoding messages with different ciphers using the Python programming language. From a simple Caesar cipher all the way through an implementation of the textbook RSA cipher. He walks you through from basic data types and decision structures through loops, data structures, common Python modules, and other advanced concepts. You read from and write to files, and learn to powerfully process and transform text with Python.
I frequently use Hacking Secret Ciphers/Cracking Codes and Automate The Boring Stuff as references for writing basic Python programs. They're outstanding resources, and it's a joy to go back through Cracking Codes, retype all the exercises, and troubleshoot them until they run. The diff tool on Mr. Sweigart's InventWithPython site is a godsend, and the ability to run the source code to see what my code should look like when it executes has helped me pass many a roadblock.
I don't quite understand how every cipher works or why it's difficult to hack, but I do generally get what each program is doing at any given point, and you can, too. If you don't quite get cryptography, this is also a neat way to look under the hood and get some of the basic concepts. It's pretty wild to see a computer hack a cipher in seconds that would take a human hours, days, or months -- if they could solve it at all.
An excellent and entertaining book of exercises. I wholeheartedly suggest it, especially for teens and adults interested in computer science and programming. Thank you for another great book, Mr. Sweigart!
- 5 out of 5 starsVerified Purchase
Learn about computers, programming, and secret codes - all in one book!
Reviewed in the United States on May 19, 2021Format: PaperbackCracking Codes with Python is a fantastic introduction to the Python programming language -- and coding in general -- using the super-fun theme of codebreaking. What's especially fun about this approach is that you can use these secret codes to send messages to your friends -- it's way better than invisible ink. As a student of computer history, I really appreciated the historical context provided for why codebreaking and ciphers are so important to the history of computers and technology. It's also great that the book provides a companion website with answers to all the practice problems at the end of each chapter, so that you can easily check your work.
I've recommended this book to folks who want to learn to code, and I'll keep doing so! By the end of it, you'll become quite the code-breaker and also a great Python programmer! I hope you enjoy it!
- 5 out of 5 starsVerified Purchase
More about learning Python than it is about Cracking Codes
Reviewed in the United States on March 15, 2018Format: PaperbackAs a Python tutorial, it is superb - comprehensive, well organized and painless. Follow along with the exercises and you'll end up with a good working knowledge of the language. Each succeeding chapter introduces more and more complex and useful language constructs, each of which is identified in the accompanying text and clearly explained. Indeed, it is the use of constructs like lists and dictionaries that make Python the very valuable and powerful scripting tool that it is.
As a Code Cracking tutorial, it is, as declared in the book sub-title, an "Introduction". You'll see how various algorithmic strategies can be used against comparatively simple ciphers. The techniques include frequency analysis, word pattern matching and dictionary tests for decrypted text.
But the book is more about Learning Python than it is about Cracking Codes. Upon completing it you'll emerge a journeyman Python programmer and a novice cryptographer.
- 4 out of 5 starsVerified Purchase
Good introduction, it help strengthen what I already knew and exposed me too newer content c
Reviewed in the United States on August 3, 2022Format: PaperbackNot much to dislike here guys! It's good to have some basic knowledge of python in hand. However, if you don't just take it one chapter at a time. It's worth it!
- 5 out of 5 starsVerified Purchase
Excellent Resource!
Reviewed in the United States on September 26, 2018Format: PaperbackPrior to picking this book up I had made various attempts to learn how to program. I would go good for a while, but then I would get bored with it and move onto something else. The practice codes that other sources provide, just don't seem to hold interest due to them not really being useful. However, Cracking Codes with Python gets right into producing something that is comprehensive and useful. In this book you learn by doing. Then he walks you through line by line and explains everything in such a way that I gained an understanding of previously misunderstood concepts.
- 5 out of 5 starsVerified Purchase
Good stuff
Reviewed in the United States on June 13, 2018Format: PaperbackDecent content, should keep a beginner busy for some time. I picked project in there and modified it so it can decode and code stuff the way I like it and added a some what UI to it. Covers most of the basics, not very deeply though, but in my opinion good enough. Would recommend, but if ur looking into cyber security, look else where, as the encryption technique in here is really just practice for newer engineers. If your looking to start your python career somewhere and specifically cyber security, this is much better than the other books on the basics.
- 5 out of 5 starsVerified Purchase
Enjoayble
Reviewed in the United States on November 18, 2021Format: KindleGood tutorial of basic python programming with the added bonus of interesting introduction to encrypting and decrypting old ciphers. It's probably the only tech book I ever read from cover to cover.
- 5 out of 5 starsVerified Purchase
Does what the title says
Reviewed in the United States on January 6, 2020Format: PaperbackGreat Book really breaks down the fundamentals of cracking.
Top reviews from other countries
Saritha5 out of 5 starsVerified PurchaseAwesome quality
Reviewed in India on August 6, 2020Format: PaperbackQuality of the book is awesome. Gave 5 start for the book quality and availability. Delivery was on time. Over all awsome experience
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
no-panic5 out of 5 starsVerified PurchaseGreat Book!
Reviewed in Germany on September 16, 2021Format: KindleA great book, but only for those who are programming Python for the first time and also have no idea about the history of cryptography. But nothing else has been promised.
One can get into Python programming and cryptography without any prior knowledge. Each chapter introduces successively further into Python programming and at the same time into the history of cryptography.
The theory, the code and also the examples are very well explained.
Also, the presentation as an ebook for Kindle is also well done, which is not a given with technical books.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Wayne5 out of 5 starsVerified PurchaseLooking forward to the study.
Reviewed in Australia on February 6, 2026Format: PaperbackI haven't sat down in earnest to study it. But, having flicked through the contents, it seems an good way to learn.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Federico5 out of 5 starsVerified PurchaseIl miglior libro da affiancare alla teoria
Reviewed in Italy on March 17, 2022Format: PaperbackSono uno studente del corso Cryptography e cercavo un libro che si approcciasse all'aspetto pratico della crittografia utilizzando Python e ho trovato questo MAGNIFICO libro. È proprio quello che cercavo!
Il libro è molto ben strutturato seguendo la tipica impronta americana che si focalizza più sulla pratica che sulla teoria (che ho apprezzato molto).
La qualità del libro è notevole e la carta è buona, lo consiglio a tutti gli interessati alla materia.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Gr3g0ry5 out of 5 starsVerified PurchaseGreat Book
Reviewed in Canada on February 1, 2020Format: PaperbackI'm addicted to these No starch Python books.
Cracking Codes is a great starting point for ciphers and encryprions. Well explained easy to follow.
Worth every cent!!
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
How customer reviews and ratings work
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.Learn more how customers reviews work on Amazon












