Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save msm-code/236f114f7fa5e92d5988742093ccda98 to your computer and use it in GitHub Desktop.

Select an option

Save msm-code/236f114f7fa5e92d5988742093ccda98 to your computer and use it in GitHub Desktop.
paper.python.9791eab6a92fd95aff480029c993e429
def parse_message(blob):
i = 0
while i < len(blob):
chunk_type = blob[i:i+4]
chunk_len = from_uint32(blob[i+4:i+8])
chunk_content = blob[i+8:i+8+chunk_len]
process_chunk(chunk_type, chunk_content)
i += 8 + chunk_len
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment