简体   繁体   中英

Reduce time on a RSA decryption in Python

I have written a RSA code in Python, but when it makes the decryption it take a lot of time (hours and hours). That's because it calculate the private key (that is very long) and then it decrypt the cryptogram raising it to the private key and making the module.

How i can reduce this time?

Code:

d = (e**(m-1))
M2 = (C**d)%n

M2 is the real message, d is the private key

使用pow(C,d,n)而不是(C**d)%n因为pow正确地进行了模幂运算。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM