Created
November 29, 2022 07:42
-
-
Save matteyeux/e459d34de2dd6badd7b505edffd08aa6 to your computer and use it in GitHub Desktop.
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
import sys | |
if len(sys.argv) != 2: | |
print("usage: hex.py [file]") | |
sys.exit(1) | |
filename = sys.argv[0] | |
with open(filename,'rb') as f: | |
buff = f.read() | |
out_hex = ['{:02X}'.format(b) for b in buff] | |
[print(f"0x{i}", end=', ') for i in out_hex] | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment