Guest User

Untitled

a guest
May 24th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. Do you wish to encrypt, decrypt, or brute force a message?
  2. Enter your message:
  3. Your translated text is:
  4. 1 LSaHc! Lipps.
  5. 2 KRZGb! Khoor.
  6. 3 JQYFa! Jgnnq.
  7. 4 IPXEZ! Ifmmp.
  8. 5 HOWDY! Hello.
  9. 6 GNVCX! Gdkkn.
  10. 7 FMUBW! Fcjjm.
  11. 8 ELTAV! Ebiil.
  12. 9 DKSzU! Dahhk.
  13. 10 CJRyT! CZggj.
  14. 11 BIQxS! BYffi.
  15. 12 AHPwR! AXeeh.
  16. 13 zGOvQ! zWddg.
  17. 14 yFNuP! yVccf.
  18. 15 xEMtO! xUbbe.
  19. 16 wDLsN! wTaad.
  20. 17 vCKrM! vSZZc.
  21. 18 uBJqL! uRYYb.
  22. 19 tAIpK! tQXXa.
  23. 20 szHoJ! sPWWZ.
  24. 21 ryGnI! rOVVY.
  25. 22 qxFmH! qNUUX.
  26. 23 pwElG! pMTTW.
  27. 24 ovDkF! oLSSV.
  28. 25 nuCjE! nKRRU.
  29.  
  30. Do you wish to encrypt, decrypt, or brute force a message?
  31. Enter your message:
  32. Your translated text is:
  33. 1 LSAHC! LIPPS.
  34. 2 LSAHC! LIPPS.KRZGB! KHOOR.
  35. 3 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.
  36. 4 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.
  37. 5 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.HOWDY! HELLO.
  38. 6 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.HOWDY! HELLO.GNVCX!
  39. GDKKN.
  40. 7 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.HOWDY! HELLO.GNVCX!
  41. GDKKN.FMUBW! FCJJM.
  42. 8 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.HOWDY! HELLO.GNVCX!
  43. GDKKN.FMUBW! FCJJM.ELTAV! EBIIL.
  44. 9 LSAHC! LIPPS.KRZGB! KHOOR.JQYFA! JGNNQ.IPXEZ! IFMMP.HOWDY! HELLO.GNVCX!
  45. GDKKN.FMUBW! FCJJM.ELTAV! EBIIL.DKSZU! DAHHK.
  46.  
  47. alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  48. message = ""
  49. encryptedmessage = " "
  50. decryptedmessage = " "
  51. keynumber = 0
  52. count = 1
  53. number = 0
  54.  
  55. def encrypt():
  56. global message
  57. global encryptedmessage
  58. global keynumber
  59. print()
  60. print()
  61. message = str(input("Enter your message:"))
  62. print()
  63. print()
  64. keynumber = int(input("Enter the key number (1-26)"))
  65. print()
  66. print()
  67. for i in message:
  68. position = alphabet.find(i)
  69. if position == -1:
  70. encryptedmessage += i
  71. else:
  72. newPosition = (position + keynumber) % 26
  73. encryptedmessage += alphabet[newPosition]
  74. print("Your translated text is:")
  75. print(encryptedmessage)
  76.  
  77.  
  78. def decrypt():
  79. global message
  80. global encryptedmessage
  81. global decryptedmessage
  82. global keynumber
  83. message = str(input("Enter your message:"))
  84. print()
  85. print()
  86. print()
  87. print()
  88. keynumber = int(input("Enter the key number (1-26)"))
  89. print()
  90. print()
  91. print()
  92. print()
  93. for i in message:
  94. position = alphabet.find(i)
  95. if position == -1:
  96. decryptedmessage += i
  97. else:
  98. newPosition = (position - keynumber) % 26
  99. decryptedmessage += alphabet[newPosition]
  100. print("Your translated text is:")
  101. print(decryptedmessage)
  102.  
  103.  
  104. def brute():
  105. global message
  106. global encryptedmessage
  107. global decryptedmessage
  108. global keynumber
  109. global count
  110. global number
  111. keynumber = 1
  112. print()
  113. print()
  114. message = str(input("Enter your message:"))
  115. print()
  116. print()
  117. print("Your translated text is:")
  118. while keynumber < 26:
  119. for i in message:
  120. position = alphabet.find(i)
  121. if position == -1:
  122. decryptedmessage += i
  123. else:
  124. newPosition = (position - keynumber) % 26
  125. decryptedmessage += alphabet[newPosition]
  126. print(str(keynumber) + decryptedmessage)
  127. keynumber = keynumber + 1
  128.  
  129. action = input("Do you wish to encrypt, decrypt, or brute force a message?")
  130.  
  131. if action == "encrypt":
  132. encrypt()
  133. if action == "decrypt":
  134. decrypt()
  135. if action == "brute":
  136. brute()
Add Comment
Please, Sign In to add comment