N
N
nnikolyaa2021-11-10 23:08:38
Python
nnikolyaa, 2021-11-10 23:08:38

Algorithm to quickly find RSA private key?

Hello
I decided to look into cryptography, to learn new things. Looked at articles, works on RSA. I decided to take a look, but then the problems began ...

func_eiler = (P-1)*(Q-1)
ekspon = random.randint(1, func_eiler)
d=0
while (ekspon*d)%func_eiler!=1:
    d+=1

Everything is going fine, but at the beginning of the search for d, there is a hard drop in speed. The whole script just sleeps. Please show the algorithm for quickly finding d

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-11-10
@nnikolyaa

Algorithm for generating public and private keys
First, ekspon should be not just random, but coprime with func_eiler. Almost always it is taken equal to 65537 and is not bothered by a random choice.
Secondly,

the number d is called the secret exponent; usually it is calculated using the extended Euclid algorithm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question