Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- texte=input('Quel est le texte à coder ?')
- print('Quelle est la clef publique ? Format n,e :')
- n=int(input('n='))
- e=int(input('e='))
- caractères_accent=['é','è','ê','ë','à','â','ù','û','ô','ç','œ','æ']
- caractères_sans_accent=['e','e','e','e','a','a','u','u','o','c','oe','ae']
- ponctuation=[',',';',':','!','?','.','\'','-']
- sans_ponctuation=['','','','','','',' ',' ']
- for i in range(12):
- texte=texte.replace(caractères_accent[i],caractères_sans_accent[i])
- for j in range(8):
- texte=texte.replace(ponctuation[j],sans_ponctuation[j])
- texte=texte.upper()
- texte=texte.replace(' ','') # pour suppripmer les espaces
- print(texte)
- def RSA(texte,n,e):
- texte_crypté=[]
- for lettre in texte:
- rang=ord(lettre)-65
- texte_crypté.append((rang**e)%n)
- return texte_crypté
- print(RSA(texte,n,e))
Add Comment
Please, Sign In to add comment