If you find any typos, please email them to [email protected]. (Apologies in advance if I haven't posted your errata submission yet or failed to give credit. Please email me to correct this.)
Additional errata is available on the No Starch Press website.
On pages 209 and 212, line 14 of the simpleSubcipher.py program should change from if keyIsValid(myKey):
to if not keyIsValid(myKey):
(Thanks to Hamid R.)
The isPrime()
function in the primeNum.py file returns False
if a prime number in LOW_PRIMES
is passed to it. It can be fixed by setting lines 83 to 88 to the following: (Thanks to David K.)
# See if any of the low prime numbers can divide num:
for prime in LOW_PRIMES:
if (num == prime):
return True
if (num % prime == 0):
return False
I made a copy/paste mistake with the code in makePublicPrivateKeys.py and the two parts that say "publicKey" should be "privateKey". On page 341, this one line of code needs to be changed from this:
64. print('The private key is a %s and a %s digit number.' % (len(str(publicKey[0])), len(str(publicKey[1]))))
to this:
64. print('The private key is a %s and a %s digit number.' % (len(str(privateKey[0])), len(str(privateKey[1]))))