Repository navigation
Decryption
Nathan Craddock edited this page Feb 25, 2021
·
1 revision
Levels 4 through 10 are stored encrypted. This means only the first three levels are playable without a registration code.
TODO see tests/crypt_test.c
Registration codes are 10-character strings in uppercase hexadecimal.
With a valid name and registration code a key can be generated to decrypt the level data in Reckless Drivin'.
The code will always evaluate to 0x1E42A71F with valid credentials.
The process to generate a code (see scripts/generate-code.py) from a registration name is as follows:
- Ensure the name is at least 4 characters long.
- Convert the name to uppercase and remove all spaces.
- Let
name_numbe the result of casting a C string representation of the last four letters of the name to int on a big-endian system. For example, the nameFREEis represented in hex ASCII as0x46 0x52 0x45 0x45. Casting to an int yields0x46524545. - Let
seedbe the result of summing the ASCII values of the first four letters of the name mod 0xFF. - Let
seed_maskbe the result of bit shiftingseedto each byte of a 32-bit int.seed + (seed << 8) + (seed << 16) + (seed << 24) - Let
code_numbe the global key XORed withname_num - Let
code_first_8becode_num ^ seed_mask - Converting
code_first_8to a hex string (prefixed with 0s as needed) and joining withseedconverted to a hex string results in the final registration code.