25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

dechiffre.py 807 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import string
  2. import sys
  3. import random
  4. def chiffre(chaine, msg):
  5. mesg_chiffre=""
  6. i=0
  7. for lettre in msg:
  8. pas=ord(chaine[i%len(chaine)])-65
  9. mesg_chiffre += decale_lettre(pas,lettre)
  10. i+=1
  11. return mesg_chiffre
  12. def decale_lettre(pas, lettre):
  13. let=((ord(lettre)-65) + pas ) % 26
  14. return chr(let+65)
  15. def main():
  16. for i in string.ascii_uppercase:
  17. for j in string.ascii_uppercase:
  18. for k in string.ascii_uppercase:
  19. cle=i+j+k
  20. msg_dechiffre = chiffre(cle, "IHDXUVZKRISCBNJWBXIDUWVVODUBPRFQRIRGBUR")
  21. if "PLEKSZYGLADZ" in msg_dechiffre:
  22. print (cle,msg_dechiffre)
  23. #return te sort du main
  24. return
  25. main()
  26. #IHDXUVZKRISCBNJWBXIDUWVVODUBPRFQRIRGBUR