I am running into problems with Hex values and python. I am trying to write a function which performs a bytewise XOR and returns a Hex value.
Basically I am trying to convert this C# code to Python:
private byte[] AddParity(string _in)
{
byte parity = 0x7f;
List<byte> _out = new List<byte>();
ASCIIEncoding asc = new ASCIIEncoding();
byte[] bytes = asc.GetBytes(_in + '\r');
foreach (byte bt in bytes)
{
parity ^= bt;
_out.Add(bt);
}
_out.Add(parity);
return _out.ToArray();
}
Can someone point me in the right direction?