Feb-23-2021, 07:00 AM
Hey, I am trying to learn low-level stuff in py3 for some crypto project, and it is pretty hard so far.
So the first question is how this byte can have such a big value, what is this notation 'AY'? I am also dealing with notations like 'x9b;', 'x16p0?', 'x17D%', and similar.
And the second question is why this gives me another value for the same byte, seems like this hex() method was wrong somehow?:
1 2 3 4 5 |
In [ 63 ]: int (b '\x12AY5' . hex (), 16 ) Out[ 63 ]: 306272565 #Value of some weird byte In [ 64 ]: int ( '11111111' , 2 ) #Highest possible val of one byte afaik Out[ 64 ]: 255 |
So the first question is how this byte can have such a big value, what is this notation 'AY'? I am also dealing with notations like 'x9b;', 'x16p0?', 'x17D%', and similar.
And the second question is why this gives me another value for the same byte, seems like this hex() method was wrong somehow?:
1 2 3 4 |
In [ 65 ]: int .from_bytes(b '\x12AY5' , byteorder = 'little' ) Out[ 65 ]: 895041810 #In [63]: int(b'\x12AY5'.hex(),16) #Out[63]: 306272565 |