Skip to content
Snippets Groups Projects
Commit 2d49b97a authored by flavio.morrone's avatar flavio.morrone
Browse files

traduction du c en python

parent 8a9a4702
No related branches found
No related tags found
No related merge requests found
import algo
def main(): def main():
print("Hello world !") mu = {
31726849986005826981,
305966565717393601613,
61497322861823383198,
269645690420162032117,
155457162093765938384,
24931468152962121635,
138444967690527010216,
282789589899417404817,
134251529920691060404,
423054566352157178418,
265453042944217161627,
39119050384849643825
} #encrypted message
n = 4556490129 * pow(10, 11) + 89940178621 #first element public key
e = 5303 #second element public key
length = length(mu)
# --- private element ---
M = [] #decriypted message
msg = "" #message (string)
p, q = 0 #primes numbers
d = 0 #private key
#--- crack RSA ---
a,b = fermat_factorization(n)
p = a + b
q = a - b
print(n == p * q, "\n")
fi = (p - 1) * (q - 1)
d = inverse_modulaire(e, fi)
#// --- decode mu & initialise msg ---
for i in range(length):
M[i] = exponentiation_rapide(mu[i], d, n)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment