Skip to content
Snippets Groups Projects
Commit d1d78a5a authored by nicolas.albanesi's avatar nicolas.albanesi
Browse files

Cast the values to int when returning

parent 8d4a3b74
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ def decode_message(l: list):
# Décode chaque bloc avec la clé privée
for m in msg:
decoded.append(exp_rapide(m, int(d), n))
decoded.append(exp_rapide(m, d, n))
# Affiche le message dans le terminal
for x in decoded:
......
......@@ -4,13 +4,13 @@ from euclide import *
def find_p_q(n):
for p in range(3, int(n/2), 2):
if (n / p).is_integer():
return p, n/p
return p, int(n/p)
def find_private_key(p, q, e):
z = (p-1) * (q-1)
r, x, y = pgcd_etendu(e, z)
return (x % z)
return int(x % z)
if __name__ == '__main__':
n = 124344401 #Clé publique 1.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment