Skip to content

Instantly share code, notes, and snippets.

@njgheorghita
Created August 8, 2017 17:40
Show Gist options
  • Save njgheorghita/84dc2a609389e1b16b10d58a467b10bb to your computer and use it in GitHub Desktop.
Save njgheorghita/84dc2a609389e1b16b10d58a467b10bb to your computer and use it in GitHub Desktop.
def preprocess_code(code):
o = 0
i = 0
pushcache = {}
code = code + b'\x00' * 32
while i < len(code) - 32:
codebyte = safe_ord(code[i])
if codebyte == 0x5b:
o |= 1 << i
if 0x60 <= codebyte <= 0x7f:
pushcache[i] = utils.big_endian_to_int(code[i + 1: i + codebyte - 0x5e])
i += codebyte - 0x5e
else:
i += 1
return o, pushcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment