Created
October 2, 2018 15:59
-
-
Save JBaczuk/66f245254bb52af73d15afd11bdf9ac5 to your computer and use it in GitHub Desktop.
Reverse Endianess of a hex string
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
if len(sys.argv) < 1: | |
print "Usage: $ reverse_endian <input-hex>" | |
line = sys.argv[1] | |
n = 2 | |
orig_list = [line[i:i+n] for i in range(0, len(line), n)] | |
reversed_list = orig_list[::-1] | |
reversed = ''.join(reversed_list) | |
print reversed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment