[pycrypto] string XOR

Dean Macinskas dmacinskas at geobridge.net
Fri Oct 21 10:01:13 CST 2011


Rich,

Thanks.  That solved the problem.

I do have a pycrypto question: does the DES3 mode support triple-length keys?  I supplied one and got no errors, but I didn't get the results I expected.

Thanks,
dpm

-----Original Message-----
From: pycrypto-bounces at lists.dlitz.net [mailto:pycrypto-bounces at lists.dlitz.net] On Behalf Of Richard Moore
Sent: Friday, October 21, 2011 10:10 AM
To: PyCrypto discussion list
Subject: Re: [pycrypto] string XOR

On Fri, Oct 21, 2011 at 2:55 PM, Dean Macinskas
<dmacinskas at geobridge.net> wrote:
>     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?

Use ord() to convert each character to a number first, then chr() to
convert the number back to a character.

Rich.
_______________________________________________
pycrypto mailing list
pycrypto at lists.dlitz.net
http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto


More information about the pycrypto mailing list