Skip to content

Instantly share code, notes, and snippets.

@upepo
Created April 29, 2015 01:00
Show Gist options
  • Save upepo/9640ec4b4bda43faa764 to your computer and use it in GitHub Desktop.
Save upepo/9640ec4b4bda43faa764 to your computer and use it in GitHub Desktop.
python long to reverse byte
def byteReverse(long_key):
a = long('{:064b}'.format(long(long_key))[::-1],2)
b = bytearray.fromhex('{:016x}'.format(a))
return bytes(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment