@Test public void testModInverse() { assertEquals(BigInteger.valueOf(2), modInverse(BigInteger.valueOf(3), BigInteger.valueOf(5))); Random rnd = new Random(); BigInteger m = new BigInteger(1024, rnd).nextProbablePrime(); for (int i = 0; i < 100; i++) { BigInteger x = new BigInteger(1023, rnd); assertEquals(x.modInverse(m), modInverse(x, m)); } }
public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); static void checkLoaded(); static int kronecker(BigInteger a, BigInteger p); static BigInteger modPowInsecure(BigInteger base, BigInteger exponent,
      BigInteger modulus); static BigInteger modPowSecure(BigInteger base, BigInteger exponent, BigInteger modulus); static BigInteger modInverse(BigInteger val, BigInteger modulus); static BigInteger exactDivide(BigInteger dividend, BigInteger divisor); static BigInteger gcd(BigInteger value1, BigInteger value2); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); static void checkLoaded(); static int kronecker(BigInteger a, BigInteger p); static BigInteger modPowInsecure(BigInteger base, BigInteger exponent,
      BigInteger modulus); static BigInteger modPowSecure(BigInteger base, BigInteger exponent, BigInteger modulus); static BigInteger modInverse(BigInteger val, BigInteger modulus); static BigInteger exactDivide(BigInteger dividend, BigInteger divisor); static BigInteger gcd(BigInteger value1, BigInteger value2);  }