Created
October 21, 2016 09:36
-
-
Save msm-code/c9ec6b6535f38e3db8b6bbb29aaa1893 to your computer and use it in GitHub Desktop.
paper.python.1031ab8a4a6a2b4e14c5b02e0ef66078
This file contains hidden or 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