XOR Python Text Шифрование / Дешифрование

Я знаю, что есть встроенный оператор xor, который можно импортировать в Python. Я'Я пытаюсь выполнить шифрование / дешифрование xor. Пока что у меня есть:

 def xor_attmpt():
    message = raw_input("Enter message to be ciphered: ")
    cipher = []
    for i in message:
        cipher.append(bin(ord(i))[2::])#add the conversion of the letters/characters
#in your message from ascii to binary withoout the 0b in the front to your ciphered message list
    cipher = "".join(cipher) 
    privvyKey = raw_input("Enter the private key: ")
    keydecrypt = []
    for j in privvyKey:
        keydecrypt.append(bin(ord(j))[2::]) #same
    keydecrypt = "".join(keydecrypt )#same

    print "key is '{0}'" .format(keydecrypt) #substitute values in string
    print "encrypted text is '{0}'" .format(cipher)
    from operator import xor
    for letter in message:
        print xor(bool(cipher), bool(keydecrypt))

Это:

>  for letter in message:
    print xor(bool(cipher), bool(keydecrypt))

где мой питон начинает идти не так

Выход выглядит так

    Enter message to be ciphered: hello
Enter the private key: \@154>
key is '10111001000000110001110101110100111110'
encrypted text is '11010001100101110110011011001101111'
False
False
False
False
False

Что я'Я пытаюсь сравнить эти два двоичных кода (ключ и зашифрованный) и дать true (1) или false (равное 0). Затем xor должен дать мне результирующий двоичный список 1 и 0 из сравнения двух. Любой вклад?

Ответы на вопрос(3)

Ваш ответ на вопрос