This code was written to compute xy mod m for large integers x, y & m. This is a high level description of the code that specifies some internal interfaces and these are some notes that I wrote to myself to guide the design. Here is how to call it.
The little Java program does one of three tricks: Here is a nice collection of tricks that I didn’t use.