Skip to content

Instantly share code, notes, and snippets.

@Tsugami
Created May 21, 2021 04:49
Show Gist options
  • Save Tsugami/41774b0bd3b7ead0bd369abbe0afeabe to your computer and use it in GitHub Desktop.
Save Tsugami/41774b0bd3b7ead0bd369abbe0afeabe to your computer and use it in GitHub Desktop.
def char_to_hex(char):
return char.encode('utf-8').hex()
def string_to_hex(string):
chars = list(string)
hex_chars = map(char_to_hex, chars)
return "".join(hex_chars)
print(string_to_hex("char"))
# 63686172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment