XOR Cipher
The XOR cipher is a symmetric-key algorithm based on the bitwise XOR operation. Each character of the cleartext message is XOR'd with each character of the key.
Warning
The key should be at least as long as the message. If it's not long enough, the key will be used multiple times, which could make the encrypted message vulnerable to Frequency Analysis.
from itertools import cycle
key = 'akWof9akeBa0'
message = 'Zettelkasten'
ciphertext = ''.join(chr(ord(c)^ord(k)) for c,k in zip(message, cycle(key)))
print(ciphertext)
print(ciphertext.encode())
plaintext = ''.join(chr(ord(c)^ord(k)) for c,k in zip(ciphertext, cycle(key)))
print(plaintext)
Relevant Note(s): Symmetric-Key Encryption