It works if you make a new XOR object for the decryption:

from Crypto.Cipher import XOR

obj_xor = XOR.new("string")
str_encrypt = "encrypt this string"
print str_encrypt

xored = obj_xor.encrypt(str_encrypt)
print xored

obj_xor = XOR.new("string")
print obj_xor.decrypt(xored)

Kent

Mark Thomas wrote:
On Thu, 31 Mar 2005 09:14:03 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:

If you post your code and the complete error message including the stack trace 
we may be able to help.

Kent


Thanks Ken

I'm getting closer to making this work using the XOR cipher. Here's
what I'm doing.

<from python>

from Crypto.Cipher import XOR

obj_xor = XOR.new("string")
str_encrypt = "encrypt this string"
xored = obj_xor.encrypt(str_encrypt)
xored
'\x16\x1a\x11\x1b\x17\x17\x07T\x06\x01\x07\x14S\x07\x06\x1b\x07\t\x14'
obj_xor.decrypt(xored)
"bhxupds&oo`g'uou`z`" <== *confused by this output*

</from python>

Close but no cigar!! *grin*


_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to