Exemplo n.º 1
0
 public void PowModTest()
 {
     // an example from http://en.wikipedia.org/wiki/Modular_exponentiation
     Assert.IsTrue(AdvancedIntegerMath.PowMod(4, 13, 497) == 445);
     // from the calculator http://www.math.umn.edu/~garrett/crypto/a01/FastPow.html
     Assert.IsTrue(AdvancedIntegerMath.PowMod(130000000, 670, 59) == 3);
     // some examples from http://modular.math.washington.edu/edu/2007/spring/ent/ent-html/node81.html
     Assert.IsTrue(AdvancedIntegerMath.PowMod(2, 60, 779167) == 710981);
     Assert.IsTrue(AdvancedIntegerMath.PowMod(2, 360360, 779167) == 584877);
 }