Computing Reviews

Cracking codes with Python :an introduction to building and breaking ciphers
Sweigart A., No Starch Press,San Francisco, CA,2018. 416 pp.Type:Book
Date Reviewed: 06/01/18

One of the many things I like about the Python programming language is that, once you learn basic Python programming, a whole host of other interesting ideas are within your grasp. I am one of those people who likes to learn things by writing some code; then fiddling with the code to see what happens; then changing the parameters to see what happens; and so on. And Python libraries allow you to do just that. This book is an example of how a little knowledge of Python can be leveraged into knowledge about another field--in this case, cryptography. Cryptography is the art of hiding information in an encoded form so that it can be passed to a receiver where it is decoded and read.

In its most elementary form, cryptography is quite common, even among people who don’t think about it at all. If you use an encrypted form of your name for a password, you are engaging in amateur cryptography. For example, say that your name is “Bob” and you shift each letter to the right, yielding “Cpc” to use as a password; you are using an encrypted version of your name as a password. There is an apocryphal story involving encryption in Stanley Kubrick’s movie 2001: A Space Odyssey. The computer was named HAL, which some saw as an encrypted version (shift left one letter) of IBM.

This book introduces the reader to elementary cryptography using examples (such as the examples just given) that can be worked out by hand. Eventually, the techniques become more complicated and simple Python programs are needed to do the encryption. The Python tutorials are as elementary as the cryptography examples, so the reader can slowly build up his or her confidence. The initial examples are all symmetric encryption, which means that the same key is used to encrypt and decrypt the message. But what if you don’t have the encryption key? Well, if the number of possible keys is small enough, you can try them all (in a Python program, not by hand) until the encrypted message can be decoded. This is known as hacking the code or decoding it via brute force.

At this level of cryptography, you can probably get away with sending encrypted love notes to your secret lover without much danger of being exposed--unless your current significant other has read this book, in which case you are in deep weeds. However, for serious encryption, where decryption in the wrong hands may have serious consequences, you need asymmetric encryption of which RSA encryption is the most well-known example. Asymmetric encryption uses one key to encrypt and another key to decrypt, and it is impossible to hack if it was done correctly. It involves mutually relatively prime numbers and generates keys hundreds of characters long.

The author explains the theory behind RSA encryption at a level that the average reader, one who is comfortable with Algebra II-level math, can understand, and provides Python code examples for encryption and decryption. The code provided does not yield bulletproof encryption, but does give one a reasonable understanding of how it works.

The book is very well written. It was a pleasure to read, and the development of the topics took me from knowing a bit about Python and very little about cryptography to knowing a bit more about Python and a lot more about cryptography. It would be of interest to programmers who would like to learn more about cryptography; it could even serve as a secondary textbook in an information security class that combines policy with some nuts-and-bolts technical understanding.

More reviews about this item: Amazon

Reviewer:  J. M. Artz Review #: CR146062 (1808-0411)

Reproduction in whole or in part without permission is prohibited.   Copyright 2024 ComputingReviews.com™
Terms of Use
| Privacy Policy