From 74ba5156dffdfe85233a013905c5d32e86a4f9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Tue, 19 Nov 2024 17:02:02 +0900 Subject: [PATCH] fix #2: do not discard trailing zero in decrypted ekey. --- src/qmc2/ekey.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qmc2/ekey.cpp b/src/qmc2/ekey.cpp index 161de66..83ec553 100644 --- a/src/qmc2/ekey.cpp +++ b/src/qmc2/ekey.cpp @@ -26,14 +26,8 @@ std::string_view span2ss(std::span span) { return std::string_view(reinterpret_cast(span.data()), span.size()); } -void remove_trailing_zeros(std::vector& vec) { - auto it = std::find_if(vec.rbegin(), vec.rend(), [](uint8_t value) { return value != 0; }); - vec.erase(it.base(), vec.end()); -} - std::vector decrypt_ekey_v1(std::string_view ekey) { std::vector result = b64_decode(reinterpret_cast(ekey.data()), ekey.size()); - remove_trailing_zeros(result); uint32_t tea_key[4] = { 0x69005600 | static_cast(result[0] << 16) | (result[1]),