From 10629c8c318f065fc3fed7dd09519bb37914dab6 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 27 Oct 2026 22:13:46 +0000 Subject: [PATCH] Decompile 2 functions in Source/Utility/Cipher/Rijndael.cpp, Source/Utility/Cipher/Rijndael.h Batch #1232 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review. - fn_04399 DecryptAes192: logic confirmed by peer review - fn_04400 DecryptAes256: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Utility/Cipher/Rijndael.cpp | 28 ++++++++++++++++++++++++++++ Source/Utility/Cipher/Rijndael.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/Source/Utility/Cipher/Rijndael.cpp b/Source/Utility/Cipher/Rijndael.cpp index 3698649a..e79db57c 100644 --- a/Source/Utility/Cipher/Rijndael.cpp +++ b/Source/Utility/Cipher/Rijndael.cpp @@ -22,6 +22,34 @@ static constexpr const char* s_errorBlockLength = "Incorrect block length"; static constexpr const char* s_errorDataLength = "Data not multiple of Block Size"; +// GLOBAL: gl_24465 +static unsigned char s_defaultAesKey[32] = { + 0x06, 0xA9, 0x21, 0x40, 0x36, 0xB8, 0xA1, 0x5B, 0x51, 0x2E, 0x03, 0xD5, 0x34, 0x12, 0x00, 0x06, + 0x06, 0xA9, 0x21, 0x40, 0x36, 0xB8, 0xA1, 0x5B, 0x51, 0x2E, 0x03, 0xD5, 0x34, 0x12, 0x00, 0x06, +}; + +// GLOBAL: gl_24466 +static unsigned char s_defaultAesChain[32] = { + 0x3D, 0xAF, 0xBA, 0x42, 0x9D, 0x9E, 0xB4, 0x30, 0xB4, 0x22, 0xDA, 0x80, 0x2C, 0x9F, 0xAC, 0x41, + 0x3D, 0xAF, 0xBA, 0x42, 0x9D, 0x9E, 0xB4, 0x30, 0xB4, 0x22, 0xDA, 0x80, 0x2C, 0x9F, 0xAC, 0x41, +}; + +// OFFSET: 0x00617EA0 +// FUNCTION: fn_04399 +void DecryptAes192(const char* input, char* output) { + CRijndael cipher; + cipher.MakeKey(reinterpret_cast(s_defaultAesKey), reinterpret_cast(s_defaultAesChain), 24, 24); + cipher.DecryptBlock(input, output); +} + +// OFFSET: 0x00617F40 +// FUNCTION: fn_04400 +void DecryptAes256(const char* input, char* output) { + CRijndael cipher; + cipher.MakeKey(reinterpret_cast(s_defaultAesKey), reinterpret_cast(s_defaultAesChain), 32, 32); + cipher.DecryptBlock(input, output); +} + const char* CRijndael::sm_chain0 = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; const int CRijndael::sm_shifts[3][4][2] = {{{0, 0}, {1, 3}, {2, 2}, {3, 1}}, {{0, 0}, {1, 5}, {2, 4}, {3, 3}}, {{0, 0}, {1, 7}, {3, 5}, {4, 4}}}; diff --git a/Source/Utility/Cipher/Rijndael.h b/Source/Utility/Cipher/Rijndael.h index 040e43b5..7f7b8fa9 100644 --- a/Source/Utility/Cipher/Rijndael.h +++ b/Source/Utility/Cipher/Rijndael.h @@ -77,6 +77,9 @@ private: /* 0454 */ int t[MAX_BC]; }; +void DecryptAes192(const char* input, char* output); +void DecryptAes256(const char* input, char* output); + #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(CRijndael) == 0x474); #endif