#!/usr/bin/env python3 import sys import struct def align(num, alignment): if num % alignment != 0: num += (alignment - num % alignment) return num def process_file(input, output): with open(input, 'rb') as fin: content = bytearray(fin.read()) align_value = 512 padded_length = align(len(content), align_value) # pad file to actual length content += b'\x00' * (padded_length - len(content)) struct_format = '