l = [10,11,12,13,14,15,16,17]
bstr = b'fedora'
to_xor = bstr[0]
How would I XOR the 8 bits of to_xor with the 8 values in the list in an efficient manner?
i.e. the binary value of to_xor,'f', is 102: 1100110
.
I would like to XOR the first bit of 'f' with the LSB of 10, second bit with the LSB of 11, third bit with LSB of 12, and so on.
1 ^ LSB of 10
1 ^ LSB of 11
0 ^ LSB of 12
This post gives some tips on converting bytes to bits, but not on XOR-ing by individual bits.