BigInteger.probablePrime() 与 java 中其他素性算法的区别
我正在使用 Java 实现 RSA 加密程序。现在我正在使用 BigInteger.probablePrime(1024, rnd) 来获取素数。这里 rnd
是由 Random rnd = new Random()
生成的随机数。 我需要测试各种加密速度。
我的问题是:
BigInteger.probablePrime(1024, rnd) 使用什么算法?
上述算法与其他算法(如 Rabin-Miller、Fermats、Lucas-Lehmer)有何区别?
谢谢。
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.
My questions are:
what algorithm does the
BigInteger.probablePrime(1024, rnd)
use?what is the difference between the algorithm above and other algorithms: like Rabin-Miller, Fermats, Lucas-Lehmer?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
BigInteger 的可能素数方法使用 Miller-Rabin 和 Lucas-Lehmer 算法来测试素数。
查看内部方法
BigInteger.primeToCertainty
< /a>.BigInteger
's probable prime methods use both the Miller-Rabin and Lucas-Lehmer algorithms to test primality.See the internal method
BigInteger.primeToCertainty
.Java源代码已经可以下载了,大家可以自己看一下。
以下是
BigInteger.probablePrime(int, Random)
的代码:实际测试包含在
smallPrime()
和largePrime()
方法中,直接在源代码中。The Java source code is available for download, so you can look at it yourself.
Here is the code for
BigInteger.probablePrime(int, Random)
:The actual tests are contained in the
smallPrime()
andlargePrime()
methods, which follow directly in the source code.