Decompile fn_18393 (DecryptAES)

Batch #18183 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_18393 DecryptAES: logic confirmed by peer review

Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-12 11:36:04 +00:00
commit c469977fc9
2 changed files with 9 additions and 6 deletions

View file

@ -481,7 +481,7 @@ void DecryptAES(const char* input, char* output, unsigned int length) {
CAES cipher(length, length);
char buffer[128];
std::memset(buffer, 0, sizeof(buffer));
cipher.Decrypt(input, buffer, length);
cipher.Encrypt(input, buffer, length);
std::memcpy(output, buffer, length);
}

View file

@ -20,7 +20,7 @@ public:
void Xor(unsigned char* destination, const unsigned char* source);
// INLINED
void Decrypt(const char* in, char* result, std::size_t n) {
void Encrypt(const char* in, char* result, std::size_t n) {
if (!this->m_bKeyInit) {
throw std::exception(sm_szErrorMsg1);
}
@ -29,10 +29,13 @@ public:
throw std::exception(sm_szErrorMsg2);
}
for (std::size_t i = 0; i < n / this->m_blockSize; ++i) {
this->DecryptBlock(in, result);
in += this->m_blockSize;
result += this->m_blockSize;
int i;
const char* pin;
char* presult;
for (i = 0, pin = in, presult = result; i < n / this->m_blockSize; ++i) {
this->EncryptBlock(pin, presult);
pin += this->m_blockSize;
presult += this->m_blockSize;
}
}