Skip to content

Instantly share code, notes, and snippets.

@zorix
Last active May 24, 2017 20:38
Show Gist options
  • Select an option

  • Save zorix/e22c01e36fb5ab4cd84f413e6ce14e3a to your computer and use it in GitHub Desktop.

Select an option

Save zorix/e22c01e36fb5ab4cd84f413e6ce14e3a to your computer and use it in GitHub Desktop.
#!/usr/bin/pypy
import itertools
import string
msg = """E0818F766572C1ACE081AFE081AEC1A7
E080A0E08195C194E081862DE080B8E0
80A0F08081B7C1A17320C1B3F08081B5
63C1A820E081A1F08080A0E081A6F080
81B5F08081AE20E081A6E081A5F08081
A1C1B475E081B2E081A5F08080AE""".replace('\n', '')
def takeByte(data):
x = bin(int(data[:2], 16))[2:]
return ('00000000'+x)[-8:]
out = ''
while len(msg) > 0:
byte = takeByte(msg)
msg = msg[2:]
needBytes = 0
ch = ''
for x in byte:
if x == '1':
needBytes+=1
else:
break
ch = byte[1 if needBytes == 0 else needBytes+1:]
needBytes -= 1
for _ in range(needBytes):
ch += takeByte(msg)[2:]
msg = msg[2:]
out += chr(int(ch, 2))
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment