-
-
Save bewest/3857132 to your computer and use it in GitHub Desktop.
decode chunk modifications
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 decode_chunk(chunk): | |
""" | |
Experiment: decode a chunk! | |
<snip> | |
""" | |
# give ourselves a copy of this record as a bytearray to sanitize things a bit. | |
record = bytearray(chunk) | |
if chunk == 0x1f: | |
try: | |
print hex(record) | |
except: | |
pass | |
else: | |
record.extend(chunk) | |
def do_chunk(handle): | |
"""read a chunk, and call decode_chunk""" | |
chunk = read_chunk(handle) | |
decode_chunk(chunk[3]) # --chunk 4, so we only read every 4th byte (the rest are NULLs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment