Skip to content

Instantly share code, notes, and snippets.

@packetchef

packetchef/hex_stuff.txt

Last active Aug 1, 2020
Embed
What would you like to do?
Convert with Python, individually:
>>> '\x3d'
'='
>>> '\x22'
'"'
>>> '\x2e'
'.'
>>> '\x5c'
'\\'
Convert with Python, all at once:
$ python -c "print('\x3d\x22\x2e\x5c')"
Get the hex value for an integer:
>>> hex(99)
'0x63'
And drop the leading 0x:
>>> hex(99)[2:]
Math:
0xF
- 0x5
------
0xA
Some other characters
A = 0x41 (ASCII 65)
Z = 0x5A (ASCII 90)
a = 0x61 (ASCII 97)
z = 0x7A (ASCII 122)
0 = 0x30 (ASCII 48)
9 = 0x39 (ASCII 57)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.