Hi Dears, according to implementation RSA in python. I found that if p and q large.

the decryption phase takes a lot of time to execute.

for example, in this code i select p=23099, q=23059, message=3

it takes 26 minute it decrypts the encrypted message.!

So I wonderful how we can select to large prime number for RSA, while it cannot execute in desired time. !

So, I think that we cannot use RSA i n real time systems.

Are you agree with me?

the source code is:

from math import gcd

import time

# defining a function to perform RSA approch

def RSA(p: int, q: int, message: int):

# calculating n

n = p * q

print(n)

# calculating totient, t

t = (p - 1) * (q - 1)

start = time.time()

# selecting public key, e

for i in range(2,t):

if gcd(i, t) == 1:

e = i

break

print("eeeeeeeeeeeeee",e)

# selecting private key, d

j = 0

while True:

if (j * e) % t == 1:

d = j

break

j += 1

print("dddddddddddddddd",d)

end = time.time()

# print(end-start)

e=0

#RSA(p=7, q=17, message=3)

RSA(p=23099, q=23059, message=3)

d=106518737

n=532639841

e=5

#RSA(p=23099, q=23059, message=3)

start= time.time()

ct=(3 ** e) % n

print(ct)

pt=(ct ** d) % n

end = time.time()

print(end-start)

print(pt)

#----------------------------------------------------

More Mohammad Zeynali Azim's questions See All
Similar questions and discussions