[pycrypto] string XOR
Paul_Koning at Dell.com
Paul_Koning at Dell.com
Fri Oct 21 10:06:13 CST 2011
"".join([chr (ord(a)^ord(b)) for a,b in zip("abc","def")])
paul
From: pycrypto-bounces at lists.dlitz.net [mailto:pycrypto-bounces at lists.dlitz.net] On Behalf Of Dean Macinskas
Sent: Friday, October 21, 2011 9:56 AM
To: pycrypto at lists.dlitz.net
Subject: [pycrypto] string XOR
This isn't a pycrypto question per se, but I thought someone might know the answer: I need to exclusive-OR two strings together. I tried operator.XOR, but I get a runtime error:
ke = operator.xor(kbpkb,ve)
TypeError: unsupported operand type(s) for ^: 'str' and 'str'
Is there a way to do this in native Python (I'm using 2.7.2), or must I use a library of some sort?
Thanks,
dpm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dlitz.net/pipermail/pycrypto/attachments/20111021/19554354/attachment.htm
More information about the pycrypto
mailing list