def VernamEncDec (text, key):
    result = ""
    ptr = 0
    for char in text:
        result = result + chr(ord(char) ^ ord(key[ptr]))
        ptr = ptr + 1
    if ptr == len(key):
        ptr = 0
    return result

key = "tojestmojklucz12345"

while True:
    input_text = input("\nWprowadz tekst do zaszyfrowania:\t")
    ciphertext = VernamEncDec(input_text, key)
    print("\nSzyfrogram:\t" + repr(ciphertext))
    plainttext = VernamEncDec(ciphertext, key)
    print("\nOdszyfrowana wiadomość:\t" + plainttext)
