55 lines
1.1 KiB
Python
55 lines
1.1 KiB
Python
|
|
# ios is little
|
|
def try_decode_int_as_ascii1(v: int, width=8):
|
|
for byteorder in ("big", "little"):
|
|
try:
|
|
b = v.to_bytes(width, byteorder=byteorder, signed=False)
|
|
except OverflowError:
|
|
continue
|
|
s = b.decode("ascii", errors="ignore").strip("\x00")
|
|
print(f"{v} -> {byteorder} {b!r} -> {s!r}")
|
|
|
|
def try_decode_int_as_ascii(v: int, width=8):
|
|
try:
|
|
b = v.to_bytes(width, byteorder='little', signed=False)
|
|
except OverflowError:
|
|
return
|
|
s = b.decode("ascii", errors="ignore").strip("\x00")
|
|
print(f"{s!r}")
|
|
|
|
versions = [
|
|
58502609449778,
|
|
54100267971378,
|
|
57390179824178,
|
|
56290668196402,
|
|
211313766962,
|
|
52983543312946,
|
|
207119397426,
|
|
232872423986,
|
|
232855581234,
|
|
55204058051122,
|
|
53000739828274,
|
|
215692358194,
|
|
215675580978,
|
|
219953771058,
|
|
54108824482354,
|
|
55204041142834,
|
|
211414037042,
|
|
219987194418,
|
|
53005068546354,
|
|
59584924889394,
|
|
220004299058,
|
|
211363836210,
|
|
232838607154,
|
|
57407393247282,
|
|
53009346736178,
|
|
53005051768882,
|
|
211397586994,
|
|
232838803506,
|
|
237133639730,
|
|
53017936212018
|
|
]
|
|
for v in versions:
|
|
try_decode_int_as_ascii(v)
|
|
|