Skip to content

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.

Checking Valid Registration Data

TODO see tests/crypt_test.c

Generating Registration Codes

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:

  1. Ensure the name is at least 4 characters long.
  2. Convert the name to uppercase and remove all spaces.
  3. Let name_num be 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 name FREE is represented in hex ASCII as 0x46 0x52 0x45 0x45. Casting to an int yields 0x46524545.
  4. Let seed be the result of summing the ASCII values of the first four letters of the name mod 0xFF.
  5. Let seed_mask be the result of bit shifting seed to each byte of a 32-bit int. seed + (seed << 8) + (seed << 16) + (seed << 24)
  6. Let code_num be the global key XORed with name_num
  7. Let code_first_8 be code_num ^ seed_mask
  8. Converting code_first_8 to a hex string (prefixed with 0s as needed) and joining with seed converted to a hex string results in the final registration code.

Clone this wiki locally