[to state the obvious, few people on this cryptography list are using pgp, and I appear to have been influenced not to as well; I'm just trying to help myself process both situations. do you use pgp? do you believe there is any reason to? this is a cryptography list.] The mpi_powm implementations are in mpi/mpi-pow.c : https://dev.gnupg.org/source/libgcrypt/browse/master/mpi/mpi-mpow.c What's exciting, is there are actually two different implementations in that one file. The old one called "simple exponentiation" starts on line 49 and goes through line 353. The second one occupies the second half of the file and starts on line 405. They're both quite big, but a lot of it looks like boilerplate. To learn modular algorithms from this file most efficiently for cracking PGP as a software developer, we want to review the parts of these implementations that directly relate to what is needed to implement modular arithmetic.