Created
February 17, 2016 01:59
-
-
Save tcarmelveilleux/3276ff874380422378f5 to your computer and use it in GitHub Desktop.
Convert hex string to C arrary
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 arrayify(name, buf): | |
return "uint8_t %s[] = { %s };" % (name, ", ".join(["0x%02X" % ord(c) for c in buf.decode('hex')])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment