Firmware Binary Diff Tool

Medium Python Debugging Asked at Seagate
Solve this problem

Compare two firmware images byte by byte and summarise the differences as contiguous regions, so a reviewer can see which sections actually changed.

Constraints

  • Inputs are two bytes objects, possibly of different lengths.
  • Return a list of (start, end, length) tuples for each differing region.
  • Regions separated by fewer than 16 identical bytes must be merged.
  • If one image is longer, the tail counts as one differing region.
  • Identical images return an empty list.
Starter codePython
1def diff_regions(image_a, image_b, merge_gap=16):2    # TODO3    return []