Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find encryption key of strings in Dragon.rrc #9

Closed
Zalasus opened this issue Jun 9, 2018 · 2 comments
Closed

Find encryption key of strings in Dragon.rrc #9

Zalasus opened this issue Jun 9, 2018 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Zalasus
Copy link
Owner

Zalasus commented Jun 9, 2018

Localized strings are stored with a "<0x****>" prefix, where **** is the hex ID of a type 0x0400 record contained in the Dragon.rrc file found in the engine root.

However, these records are XOR encrypted (at least in the German version of the game). By comparing known translated strings with the contents of their corresponding record, I could determine the first 7 bytes of the key: 0D 6A 57 BF FD EE 74

This string is not found in any of the binaries, and I could not find it by inspecting the memory of the running engine. So either the key is generated on the fly, or the engine only keeps it in memory when decoding strings.

There are some type 0x0401 records in the Dragon.rrc file which contain a number of 32 bit integers, the purpose of which I could not yet determine. Other 0x0401 records contain unencrypted text, but the values in these specific ones are all non-printable. Perhaps they are somehow related to the encryption key.

Since some strings that are used for the UI are only found in this location, it is vital that we find this key.

@Zalasus Zalasus added enhancement New feature or request help wanted Extra attention is needed labels Jun 9, 2018
@UCyborg
Copy link

UCyborg commented Jun 10, 2018

Give this patch a try: https://gist.github.com/UCyborg/e16d39f716e397869655d6c1b5d4c69e

You can find the decryption loop in Drakan.exe at memory address 0x0042CE91, it's pretty neat. The implementation in the linked patch should be portable.

Zalasus added a commit that referenced this issue Jun 11, 2018
@Zalasus
Copy link
Owner Author

Zalasus commented Jun 11, 2018

This works like a treat! Thank you so much 👍

@Zalasus Zalasus closed this as completed Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants