Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def inv_RSA(liste_codes,n,d):
- longueur=len(liste_codes)
- texte_décrypté=''
- for i in range(longueur):
- rang_décodé=(liste_codes[i]**d)%n
- lettre_décryptée=chr(rang_décodé+65)
- texte_décrypté=texte_décrypté+lettre_décryptée
- return texte_décrypté
- chaine_codes=(input('Quelle est la liste de codes ?'))
- chaine_codes=chaine_codes.replace(' ','')
- chaine_codes=chaine_codes.replace('[','')
- chaine_codes=chaine_codes.replace(']','')
- liste_codes=chaine_codes.split(',')
- for i in range (len(liste_codes)):
- liste_codes[i]=int(liste_codes[i])
- print('Quelle est la clef privée ? Format n,d :')
- n=int(input('n='))
- d=int(input('d='))
- print(inv_RSA(liste_codes,n,d))
Add Comment
Please, Sign In to add comment