Reputation: 23
Today I've started learn about reverse engineering. I met struc.pack(), but I dont know what \x12 meaning.
from struct import pack
pack('>I', 0x1337)
'\x00\x00\x137'
So \x137 is equal to 0x1337 (hex) in big-edian?
Upvotes: 2
Views: 224
Reputation: 90979
'0x137'
is not a single byte, its actually two different bytes - 0x13
and 0x37
(or the character '7'
) . The hexadecimal value for the ascii value of '7'
is 0x37
, hence you get 0x137
. Example -
>>> hex(ord('7'))
'0x37'
Upvotes: 1