米游社DS算法
参考
https://github.com/UIGF-org/mihoyo-api-collect/issues/1
最新salt(2024-04-02 2.69.1)
4X | 6X | PROD |
---|---|---|
xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs | t0qEgfub6cvueAPgR5m9aQWWVciEer7v | JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS |
DS2算法复现
#include <iostream>
#include <string>
#include <cmath>
//_ZL12ANDROID_SALT <= Java_com_mihoyo_hyperion_net_aaaaa_a2222 <= libxxxxxx.so
unsigned int ANDROID_SALT[32] = {
0x000000CC, 0xFFFFFD27, 0xFFFFFF8E, 0xFFFFFFBA, 0xFFFFFF98, 0x000000A2, 0xFFFFFF8A, 0x00000096,
0xFFF7E40F, 0xFFFFFF9C, 0x000000D2, 0xFFFFFF8A, 0xFFFFFF9A, 0xFFFFFFBE, 0x00000060, 0xFFFFFF98,
0x00000066, 0xFFFD4C05, 0xFFFFFF92, 0xFF250D95, 0xFFFFFF9E, 0xFFFFFFAE, 0xFFFFFFA8, 0xFFFFFFA8,
0x00000072, 0xFFFFFF9C, 0xFFFFFF96, 0xFFFFFFBA, 0xFFFFFF9A, 0x000000C6, 0xFFE7AC2D, 0x000000D2
};
//_ZL12ANDROID_SALT <= Java_com_mihoyo_hyperion_net_aaaaa_b5555 <= libxxxx.so
unsigned int _ZL12ANDROID_SALT[32] = {
0x000000D8, 0x00000072, 0xFFB70487, 0x000000D2, 0xFFFF1957, 0xFFFFFFAE, 0xFFFFFF8A, 0xFFFD4C05,
0xFFFF1957, 0x000000B4, 0xFFFFFFAA, 0xFFFFFFB4, 0x000000C6, 0xFFFFFFBA, 0xFFFFFFA6, 0x00000042,
0x0000007E, 0xFFFFFF94, 0x0000004E, 0x000000A8, 0x00000036, 0xFFB70487, 0xFFFFFF9C, 0xFFFFFF8A,
0xFFFFFFB0, 0x000000A8, 0xFF250D95, 0xFFFFFFBE, 0xFFFFFF8C, 0xFFFFFF9E, 0x000000A2, 0xFFFFFF8C
};
//计算条件
unsigned long long CONDITIONS[2][2] = {
{0x5EFEBB5EuLL, 0x400A0102uLL},
{0xBDE26DF4uLL, 0x4200194uLL}
};
std::string ds2(unsigned long long condition[], unsigned int salt[]){
std::string result;
for (int v12 = 0; v12 < 32; ++v12) {
unsigned int v13 = salt[v12];
char v14;
if ((condition[0] >> v12) & 1) {
if ((condition[1] >> v12) & 1) {
double log_value = log(static_cast<double>(-v13));
v14 = static_cast<char>(std::ceil(log_value / 1.09861229) - 6.0 + 48.0);
} else {
v14 = ~static_cast<char>(v13);
}
} else {
v14 = static_cast<char>(v13 / 3 + 48);
}
result += v14;
}
return result;
}
int main() {
std::cout << "SALT_x4 : " << ds2(CONDITIONS[1],_ZL12ANDROID_SALT) << std::endl; //xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs
std::cout << "SALT_x6 : " << ds2(CONDITIONS[0],ANDROID_SALT) << std::endl; //t0qEgfub6cvueAPgR5m9aQWWVciEer7v
}