Advertisement
Guest User

Untitled

a guest
Oct 5th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. decrypted = b"abcdefghijklmnopqrstuvwxyz "
  3. encrypted = b"qwertyuiopasdfghjklzxcvbnm "
  4.  
  5. encrypt_table = bytes.maketrans(decrypted, encrypted)
  6. decrypt_table = bytes.maketrans(encrypted, decrypted)
  7.  
  8. result = ''
  9. choice = ''
  10. message = ''
  11.  
  12. while choice != '0':
  13. choice = input("\n Do you want to encrypt or decrypt the message?\n 1 to encrypt, 2 to decrypt or 0 to exit program. ")
  14.  
  15. if choice == '1':
  16. message = input('\nEnter message for encryption: ')
  17. result = message.translate(encrypt_table)
  18. print("result + '\n\n'")
  19.  
  20. elif choice == '2':
  21. message = input('\nEnter message to decrypt: ')
  22. result = message.translate(decrypt_table)
  23. print("result + '\n\n'")
  24.  
  25. elif choice != '0':
  26. print('You have entered an invalid input, please try again. \n\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement