I have a string byte generated by the Random module of the PyCrypto library in this way:
c = Random.new().read(13)
Now, I want to invert the value of the bits that make c
with the unary operator ~
, but I can not do it because it is a byte string (apparently I can only use it with int).
For example, if hypothetically the value of the bits that make up 'c' were 1001010
would want to have a byte string whose bits were 0110101
...
Is there any way to perform the operation and still have a string byte of the same size?