In MA158 Cryptography, Jeff Hoffstein said that it’s okay for us to share code.
So, who can resist? I’ve been doing all of my homework with the help of a Scheme library with support for modular arithmetic (mod, ^-mod, and inverse-mod), congruence solving (x-congruent-to), a Pohlig-Hellman solver (pohlig-hellman-dlp), a Miller-Rabin prime checker (miller-rabin-probable-prime), the Jacobi operator (jacobi), and a suite of continued fraction functions (continued-fraction->latex, evaluate-each-continued-fraction, continued-fraction). To run it you’ll need a copy of PLT Scheme; use the “(module ...)” language.
You might notice that some functions produce long Latex derivations; to turn this off, run (currently-deriving #f).
Questions should go to email hidden; JavaScript is required.
I should note that I ended up getting a B: on the exam, we had to actually evaluate some of the functions we’d discussed. Having written them as code, I had completely forgotten them.