Leamich

inno quest ikb

Jun 9th, 2024
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import sys
  2. from base64 import b64decode
  3.  
  4.  
  5. sys.stdin = open(r"path to messages.txt")
  6.  
  7. def caesar_cipher(text, shift):
  8.     result = ""
  9.     for char in text:
  10.         if char.isalpha():
  11.             start = ord('A') if char.isupper() else ord('a')
  12.             result += chr((ord(char) - start + shift) % 26 + start)
  13.         else:
  14.             result += char
  15.     return result
  16.  
  17. def decode(line):
  18.     s = b64decode(line.split()[2])
  19.     ciphertext = caesar_cipher(str(s)[2:-1], 13)
  20.     return ciphertext
  21.  
  22. while True:
  23.     plaintext = input()
  24.     print(decode(plaintext))
  25.  
Add Comment
Please, Sign In to add comment