問題描述
我正在使用 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
.
這篇關于Java 中 BigInteger.probablePrime() 與其他素數算法的區別的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!