How to XOR a byte output?

Marko Rauhamaa marko at pacujo.net
Thu Apr 14 05:18:16 EDT 2016


durgadevi1 <srirajarajeswaridevikrupa at gmail.com>:

>>    >>> bytes(c ^ k for c, k in zip(code, key)).decode()
>
> [...]
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 0:
> invalid start byte
>
> [...]
>
> However, I get no errors when using values 0 to 127 to XOR with CODE.
> But I get errors when using values (128 to 255). May I know how I can
> modify the program code so that i can XOR with values (128 to 255)?

Leave out .decode() at the end.


Marko



More information about the Python-list mailing list