Created
April 29, 2015 01:00
-
-
Save upepo/9640ec4b4bda43faa764 to your computer and use it in GitHub Desktop.
python long to reverse byte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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