Android : How to generate BigInteger.probablePrime randomly in android?

on Friday, August 29, 2014


I'm using this code, I tried in netbean can run well, but when I tried in eclipse for android project it doesn't work. I want to get public Key randomly, but the result is always "35879".



publicKey = BigInteger.probablePrime(10, new Random());

while (phi.gcd(publicKey).compareTo(BigInteger.ONE) > 0 && publicKey.compareTo(phi) < 0 ) {
publicKey.add(BigInteger.ONE);
}

0 comments:

Post a Comment