[pycrypto] string XOR

Richard Moore richmoore44 at gmail.com
Fri Oct 21 08:09:36 CST 2011


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.


More information about the pycrypto mailing list