Java 中 BigInteger.probablePrime() 与其他素数算法的区别
我正在使用 Java 实现一个 RSA 加密程序.现在我正在使用 BigInteger.probablePrime(1024, rnd) 来获取素数.这里 rnd 是由 Random rnd = new Random() 生成的随机数.我需要测试各种加密速度.
I am implementing an RSA encryption program using Java. Right now I am using BigInteger.probablePrime(1024, rnd) to get prime numbers. Here rnd is a random number generated by Random rnd = new Random() .
I need to test various speeds of encryption.
我的问题是:
BigInteger.probablePrime(1024, rnd)使用什么算法?
上面的算法和其他算法有什么区别:比如 Rabin-Miller、Fermats、Lucas-Lehmer?
what is the difference between the algorithm above and other algorithms: like Rabin-Miller, Fermats, Lucas-Lehmer?
谢谢.
推荐答案
BigInteger 的可能素数方法使用 Miller-Rabin 和 Lucas-Lehmer 算法来测试素数.
BigInteger's probable prime methods use both the Miller-Rabin and Lucas-Lehmer algorithms to test primality.
查看内部方法BigInteger.primeToCertainty代码>.
See the internal method BigInteger.primeToCertainty.
相关文章