diff --git a/Day 18/dance/data/usr/bin/dance.id0 b/Day 18/dance/data/usr/bin/dance.id0 index 3a94236..0443968 100644 Binary files a/Day 18/dance/data/usr/bin/dance.id0 and b/Day 18/dance/data/usr/bin/dance.id0 differ diff --git a/Day 18/dance/data/usr/bin/dance.id1 b/Day 18/dance/data/usr/bin/dance.id1 index 7f1dbf9..a93d237 100644 Binary files a/Day 18/dance/data/usr/bin/dance.id1 and b/Day 18/dance/data/usr/bin/dance.id1 differ diff --git a/Day 18/dance/data/usr/bin/dance.til b/Day 18/dance/data/usr/bin/dance.til index a96fe11..4e4c746 100644 Binary files a/Day 18/dance/data/usr/bin/dance.til and b/Day 18/dance/data/usr/bin/dance.til differ diff --git a/Day 18/decode.py b/Day 18/decode.py index 316f3d3..cc4f332 100644 --- a/Day 18/decode.py +++ b/Day 18/decode.py @@ -1,36 +1,9 @@ -unk_100007F50 = [0x03, 0x20, 0x63, 0x46, 0x61, 0xB6, 0x3C, 0xAF, 0xAA, 0x76, 0xC2, 0x7E, 0xEA, 0x00, 0xB5, 0x98] -a4 = -5678246756302764783 +from Crypto.Cipher import Salsa20 -# input = "096CD446EBC8E04D2FDE299BE44F322863F7A37C18763554EEE4C99C3FAD15" -# print(len(input), len(unk_100007F50)) +KEY = bytearray.fromhex("0320634661B63CAFAA76C27EEA00B59BFB2F7097214FD04CB257AC2904EFEE46") +NONCE = bytearray.fromhex("B132D0A8E78F4511")[::-1] +ENCRYPTED = bytearray.fromhex("096CD446EBC8E04D2FDE299BE44F322863F7A37C18763554EEE4C99C3FAD15") -def dance_words(): - pass - -def dance_block(buf, unk, const, num): - pass - -def dance(input): - if len(input) > 0: - v4 = -567824675630276478 - v5 = unk_100007F50 - v6 = len(input) - v7 = input - v8 = 0 - v9 = [0] * 64 - - while True: - - if v8 == 0: - dance_block(v9, v5, v4, 0) - - v7[v8] = ord(v7[v8]) ^ v9[0] - v8 = v8 + 1 - if v6 == v8: - break - - return v7 - -input = ["0"] * 32 -output = dance(input) -print(output) +cipher = Salsa20.new(key=KEY, nonce=NONCE) +plaintext = cipher.decrypt(ENCRYPTED) +print(plaintext.decode("UTF-8"))