I am used to the python byte literal syntax representing bytes as hex values such as b'\x7a'
is the hex value 0x7a
. I however have run into an issue that I don't know how it is working. I am using the ssl library for the first time and creating random values with ssl.RAND_bytes(...)
It is returning strings with characters that alter the value (say when doing an int.from_bytes(...)
)
Example strings I have received:
b'\x12\x1f)\x8b\xe0\xd7LD'
b'\x808\x8a(\x02\xb3S\xc9\xabW_\n\xf3\xbb\x80o'
b'\xde\xef\x81%FMB=Ps'
b'9\x81\x90\xdc\xfa\x98\xbd\x1f^;'
What I don't understand are those non hex value characters, such as the 9
preceding the \x81
or the MB=Ps
. I would like to understand what these extra values represent and how I can interpret them when debugging my code. I know python has no issue with these, it is me who is at a loss.
Note: I am on python3.3 on windows 7 64bit