|
|
@ -28,8 +28,8 @@ def hexdump(data: bytes) -> list[str]: # We will be prefixing the lines with sig
|
|
|
|
offset_len = math.ceil(math.log(len(data), 16))
|
|
|
|
offset_len = math.ceil(math.log(len(data), 16))
|
|
|
|
while data:
|
|
|
|
while data:
|
|
|
|
left_chunk, right_chunk, data = data[:8], data[8:16], data[16:]
|
|
|
|
left_chunk, right_chunk, data = data[:8], data[8:16], data[16:]
|
|
|
|
left_ascii = ''.join(chr(x) if x in range(32,127) else ',' for x in left_chunk)
|
|
|
|
left_ascii = ''.join(chr(x) if x in range(32,127) else '.' for x in left_chunk)
|
|
|
|
right_ascii = ''.join(chr(x) if x in range(32,127) else ',' for x in right_chunk)
|
|
|
|
right_ascii = ''.join(chr(x) if x in range(32,127) else '.' for x in right_chunk)
|
|
|
|
offset_str = f'{offset:0{offset_len}x}'
|
|
|
|
offset_str = f'{offset:0{offset_len}x}'
|
|
|
|
line = f"{offset_str} {left_chunk.hex(' ').ljust(23)} {right_chunk.hex(' ').ljust(23)} |{left_ascii.ljust(8)}{right_ascii.ljust(8)}|"
|
|
|
|
line = f"{offset_str} {left_chunk.hex(' ').ljust(23)} {right_chunk.hex(' ').ljust(23)} |{left_ascii.ljust(8)}{right_ascii.ljust(8)}|"
|
|
|
|
offset += 16
|
|
|
|
offset += 16
|
|
|
|