Skip to content

Instantly share code, notes, and snippets.

@aeppert
Created December 20, 2016 18:10
Show Gist options
  • Select an option

  • Save aeppert/964a975f0a05fc1d4360dc44e8dc1094 to your computer and use it in GitHub Desktop.

Select an option

Save aeppert/964a975f0a05fc1d4360dc44e8dc1094 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
def chunker(seq, size):
return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))
def word_to_ord(s):
ret = ''
for i in s:
ret += str(ord(i))
return ret
def ord_to_word(o):
ret = ''
for i in chunker(o, 2):
ret += chr(int(i))
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment