Advertisement
z1rix

Caesar cipher Python

May 22nd, 2021
874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. key = int(input('Scrivte una chiave: '))
  2. text = input('Scrivete qualcosa: ')
  3.  
  4.  
  5. def encrypt_c():
  6.     encrypted_text = ''
  7.     for symbol in text:
  8.         encrypted_text += chr(ord(symbol)+key)
  9.  
  10.     print(encrypted_text)
  11.  
  12.  
  13. def decrypt_c():
  14.     decrypted_text = ''
  15.     for symbol in text:
  16.         decrypted_text += chr(ord(symbol) - key)
  17.  
  18.     print(decrypted_text)
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement