我想通过自己计算的RSA算法。我需要计算在一定功率的数目的模数。问题是,这个数字在某些功率可以得到相当大的。
I want to calculate the RSA algorithm by myself . I need to calculate the modulus of a number at a certain power. The thing is that that number at that certain power can get quite big.
下面是我想要的:
x = pow(n, p) % q
我怎样才能有效地确定X'
How can I efficiently determine x?
如果您使用的是.NET 4,我建议你看看BigInteger,甚至提供了ModPow方法做这一切在一个单一的操作:)
If you're using .NET 4, I suggest you look at BigInteger
, which even provides the ModPow
method to do it all in a single operation :)
BigInteger n = ...;
BigInteger p = ...;
BigInteger q = ...;
BigInteger x = BigInteger.ModPow(n, p, q);
上一篇:如何阅读与非标准codePAGE EBCDIC的数据,并没有乱了数字?并没有、与非、数字、标准
下一篇:片段在.NET 4 WebBrowser控件(锚#)迷失与Adobe PDF阅读器和文件://阅读器、控件、片段、文件