Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pack.py #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@
print ('[i] Magic: {}'.format(MAGIC_FOOTER))
part.write(MAGIC_FOOTER.encode())
print ('[i] Header CRC: 0x{:02X}'.format(headerCRC))
part.write(struct.pack('L', headerCRC))
part.write(struct.pack('<L', headerCRC))

# Step #2 Calculate CRC2
mergedCRC = utils.crc32(mergedPart)
with open(footerPart, 'wb') as footer:
print ('[i] Merged CRC: 0x{:02X}'.format(mergedCRC))
footer.write(struct.pack('L', mergedCRC))
footer.write(struct.pack('<L', mergedCRC))
print ('[i] First 16 bytes of header: {}'.format(header16bytes))
footer.write(header16bytes)

Expand All @@ -321,9 +321,9 @@
print ('[i] Magic: {}'.format(MAGIC_FOOTER))
footer.write(MAGIC_FOOTER.encode())
print ('[i] Header CRC: 0x{:02X}'.format(headerCRC))
footer.write(struct.pack('L', headerCRC)) # struct.pack('L', data) <- returns byte swapped data
footer.write(struct.pack('<L', headerCRC)) # struct.pack('L', data) <- returns byte swapped data
print ('[i] Bin CRC: 0x{:02X}'.format(binCRC))
footer.write(struct.pack('L', binCRC))
footer.write(struct.pack('<L', binCRC))
print ('[i] First 16 bytes of header: {}'.format(header16bytes))
footer.write(header16bytes)

Expand Down