in atr/util.py [0:0]
def _generate_hexdump(data: bytes) -> str:
"""Generate a formatted hexdump string from bytes."""
hex_lines = []
for i in range(0, len(data), 16):
chunk = data[i : i + 16]
hex_part = binascii.hexlify(chunk).decode("ascii")
hex_part = hex_part.ljust(32)
hex_part_spaced = " ".join(hex_part[j : j + 2] for j in range(0, len(hex_part), 2))
ascii_part = "".join(chr(b) if 32 <= b < 127 else "." for b in chunk)
line_num = f"{i:08x}"
hex_lines.append(f"{line_num} {hex_part_spaced} |{ascii_part}|")
return "\n".join(hex_lines)