Skip to content

Instantly share code, notes, and snippets.

@SuperDoxin
Created January 4, 2019 15:57
Show Gist options
  • Save SuperDoxin/fde4fdad237e85a90c8764cdf88eadf5 to your computer and use it in GitHub Desktop.
Save SuperDoxin/fde4fdad237e85a90c8764cdf88eadf5 to your computer and use it in GitHub Desktop.
dct = {}
x, dct[x], x, dct[x], x, dct[x], x, dct[x], x, dct[x], x, dct[x], x, dct[x],\
x, dct[x], x, dct[x], x, dct[x], x, dct[x], x, dct[x] = \
'\u0101\u0200\u0201\u0100'\
'\u0102\u0148\u0103\u0157\u0104\u012c\u0105\u0120\u0106\u0121'\
'\u0202\u0265\u0203\u026c\u0204\u026f\u0205\u0272\u0206\u0264'
def decode(inp):
state = '\x01'
for item in inp:
val = chr((ord(state) << 8)+ord(item))
res = dct[val]
output = chr(ord(res) & 0xff)
state = chr(ord(res) >> 8)
if output != '\x00':
yield output
def do_complex_things():
A = type('decode', (type, ), {
'__call__': lambda a, *b, **c: print(''.join(
globals()[a.__class__.__name__](
'\x02\x01\x02\x03\x03\x04\x01\x04'
'\x05\x03\x01\x04\x05\x03\x06\x01\x06'
)
))
})
B = A('decode', (object,), {})
C = type('decode', (B, ), {})
return C
do_complex_things()()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment