Skip to content

Instantly share code, notes, and snippets.

@packetchef
Last active August 1, 2020 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save packetchef/8c23799f7e78383d1abd1b80470c7d91 to your computer and use it in GitHub Desktop.
Save packetchef/8c23799f7e78383d1abd1b80470c7d91 to your computer and use it in GitHub Desktop.
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