Jump to content
  • 0

I need to find the formula to re-encrypt this specific decrypted value so I can find other values with the same encryption


zyRoxityy

Question

Posted

In this game the total amount of food fed to a monster determines the level, here is what I've found:

DECRYPTED QWORD "5,100" gets encrypted to these two values: "3,368,828,482,757,853,184" and "-370,171,316,218,594,392"
After feeding the monster with 1,280 more food this is what happens to the same two encrypted values:
DECRYPTED QWORD "6,380" gets encrypted to these two values: "3,368,816,388,129,947,648" and "-370,171,316,218,597,208"

What is the formula to encrypt these decrypted values (6,380 and 5,100) with the same encryption method the game uses so I can find out other encrypted values?

3 answers to this question

Recommended Posts

Posted

You actually have one encrypted value, because your encrypted values overlap with one another (have common 4 bytes). In the following table it is shown how provided values are stored in memory:

Qword value (interpreted as signed integer) | Little-endian hex representation
-------------------------------------------------------------------------------
5,100                                       | EC 13 00 00 00 00 00 00
3,368,828,482,757,853,184                   | 00 00 00 00 A8 7B C0 2E
-370,171,316,218,594,392                    | A8 7B C0 2E 26 E3 DC FA
6,380                                       | EC 18 00 00 00 00 00 00
3,368,816,388,129,947,648                   | 00 00 00 00 A8 70 C0 2E
-370,171,316,218,597,208                    | A8 70 C0 2E 26 E3 DC FA

So you have the following correspondence between real values and encrypted values: 

Real value              | Encrypted value
--------------------------------------------------
EC 13 00 00 00 00 00 00 | A8 7B C0 2E 26 E3 DC FA
EC 18 00 00 00 00 00 00 | A8 70 C0 2E 26 E3 DC FA

As you can see, real values and encrypted values differ only in second digit of their second bytes. And it can be observed that the result of XOR'ing differing digits is same for real values and encrypted values: 

0x3 XOR 0x8 = 0011b XOR 1000b = 1011b (0xB)
0xB XOR 0x0 = 1011b XOR 0000b = 1011b (0xB)

This indicates that values are encrypted by XOR'ing them with a same key (that can, however, be different between different launches of the game): 

encrypted_value = real_value XOR key

The key can be calculated from real value and encrypted value that corresponds to it as follows: 

key = real_value XOR encrypted_value

For the values that you provided the key is (using big-endian hex representations of real and encrypted value, the result is also big-endian): 

key = 0x00000000000013EC XOR 0xFADCE3262EC07BA8
key = 0xFADCE3262EC06844

An example of calculating encrypted value for desired real value using calculated key: 

desired_value = 999000 = 0xF3E58

encrypted_value = 0x00000000000F3E58 XOR 0xFADCE3262EC06844
encrypted_value = 0xFADCE3262ECF561C

To edit the value with GG using big-endian hex value as input, "0x" prefix needs to be removed and "h" suffix needs to be added: 

0xFADCE3262ECF561C => FADCE3262ECF561Ch

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.