Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Last active February 14, 2018 14:49
Show Gist options
  • Save AndyNovo/95449c2c20553bd09469289fc0527747 to your computer and use it in GitHub Desktop.
Save AndyNovo/95449c2c20553bd09469289fc0527747 to your computer and use it in GitHub Desktop.
m="Hi there"
print m
hexstr = m.encode('hex')
print hexstr
integer_m = int(hexstr, 16)
print integer_m
back2hex = format(integer_m, 'x')
print back2hex
evenpad = ('0' * (len(back2hex) % 2)) + back2hex
plaintext = evenpad.decode('hex')
print plaintext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment