mirror of
https://gitea.tendokyu.moe/beerpsi/x.git
synced 2026-09-22 22:28:05 +03:00
fix asciiex bullshit
This commit is contained in:
@@ -34,12 +34,27 @@ ASCII_EX_CHARACTERS = (
|
||||
)
|
||||
|
||||
|
||||
def to_ascii(input: bytes):
|
||||
output: list[int] = []
|
||||
|
||||
for b in input:
|
||||
while b >= 122:
|
||||
b -= 122
|
||||
|
||||
while b < 48:
|
||||
b += 48
|
||||
|
||||
output.append(b)
|
||||
|
||||
return bytes(output)
|
||||
|
||||
|
||||
def to_ascii_ex(input: bytes):
|
||||
output: list[int] = []
|
||||
|
||||
for b in input:
|
||||
b = (b - 48) % len(ASCII_EX_CHARACTERS)
|
||||
output.append(b)
|
||||
output.append(ord(ASCII_EX_CHARACTERS[b]))
|
||||
|
||||
return bytes(output)
|
||||
|
||||
@@ -69,12 +84,15 @@ with (cast(Path, args.mu3_data_path) / "resources.assets").open("rb") as f:
|
||||
key=args.key_iv_digest_fixed
|
||||
).digest()
|
||||
|
||||
if data.m_Name in {"noise0", "noise1"}:
|
||||
key = to_ascii(key)
|
||||
|
||||
if args.ascii_ex:
|
||||
key = to_ascii_ex(key)
|
||||
|
||||
if data.m_Name == "noise1":
|
||||
key = key[:16]
|
||||
elif data.m_Name == "noise2":
|
||||
key = key[:8]
|
||||
|
||||
if args.ascii_ex and data.m_Name in {"noise0", "noise1"}:
|
||||
key = to_ascii_ex(key)
|
||||
|
||||
print(f"{FILE_MAP[data.m_Name]}: {key.hex()}")
|
||||
|
||||
Reference in New Issue
Block a user