Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save msm-code/23c0c5cbbcf9c7dfcb24734166b858f9 to your computer and use it in GitHub Desktop.
Save msm-code/23c0c5cbbcf9c7dfcb24734166b858f9 to your computer and use it in GitHub Desktop.
paper.python.1031ab8a4a6a2b4e14c5b02e0ef66078
def parse_static_config(blob):
i = 0
while i < len(blob):
chunk_type = blob[i:i+4] # chunk type, also called "hash" or "chunk hash" in this article
chunk_len = from_uint32(blob[i+4:i+8])
chunk_content = blob[i+8:i+8+chunk_len]
process_chunk(chunk_type, chunk_content) # this function should process every type of chunk
i += 8 + chunk_len
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment