Skip to content

Instantly share code, notes, and snippets.

@tcarmelveilleux
Created February 17, 2016 01:59
Show Gist options
  • Save tcarmelveilleux/3276ff874380422378f5 to your computer and use it in GitHub Desktop.
Save tcarmelveilleux/3276ff874380422378f5 to your computer and use it in GitHub Desktop.
Convert hex string to C arrary
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