Hacking Secret Ciphers with Python

(Ann) #1

196 http://inventwithpython.com/hacking


Email questions to the author: [email protected]


MODULAR ARITHMETIC WITH


THE MULTIPLICATIVE AND


AFFINE CIPHERS


Topics Covered In This Chapter:
 Modular Arithmetic
 “Mod” is “Remainder Of”(Sort Of)
 GCD: Greatest Common Divisor (aka Greatest Common Factor)
 Multiple Assignment Trick
 Euclid’s Algorithm for Finding the GCD of Two Numbers
 “Relatively Prime”
 The Multiplicative Cipher
 Finding Modular Inverses
 The cryptomath Module


“People have been defending their own privacy for centuries
with whispers, darkness, envelopes, closed doors, secret
handshakes, and couriers. The technologies of the past did
not allow for strong privacy, but electronic technologies do.”

Eric Hughes, “A Cypherpunk's Manifesto”, 1993
Free download pdf