H
H
hardwellZero2015-02-15 15:34:37
Python
hardwellZero, 2015-02-15 15:34:37

How to implement XOR encryption?

Hello.
I'm trying to write a small program for XOR encryption.
There were problems with the implementation, due to lack of knowledge.
It is necessary to implement the input of a message and a key from the keyboard.
Encrypt and output the cipher.
Decrypt and output.
Now I'm trying to translate each letter separately in the message

for letter in message:
        print bin(ord(letter))[2:]

And I don't know what to do next.
I think that you still need to check for the number of characters:
while список.__len__() < 8:
    список.insert(0, '0')

What do you advise?
Or maybe there are already ready-made solutions that you can figure out.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
un1t, 2015-02-15
@hardwellZero

This type of encryption is in pycrypto

from Crypto.Cipher import XOR
key = '123'
cipher = XOR.new(key)
text = 'plaintext'
cipher.encrypt(text)

G
Galina Ushakova, 2015-02-15
@9999galinka

in what language?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question