Skip to content

Instantly share code, notes, and snippets.

@JBaczuk
Created October 2, 2018 15:59
Show Gist options
  • Save JBaczuk/66f245254bb52af73d15afd11bdf9ac5 to your computer and use it in GitHub Desktop.
Save JBaczuk/66f245254bb52af73d15afd11bdf9ac5 to your computer and use it in GitHub Desktop.
Reverse Endianess of a hex string
#!/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