Created
October 21, 2016 09:57
-
-
Save msm-code/23c0c5cbbcf9c7dfcb24734166b858f9 to your computer and use it in GitHub Desktop.
paper.python.1031ab8a4a6a2b4e14c5b02e0ef66078
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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