Skip to content

Instantly share code, notes, and snippets.

For this example, the first 18 digits of our key are 111122222223333333.

The user entered key is first split into 2 parts, the first 18 characters and the remaining 4 characters. It then calculates the checksum for the first 18 digits in the function starting at address 004061c0.

The program then pads the first 18 characters with 5 zeros at the beginning and end - 0000011112222222333333300000. This is all the first 170 lines of this function seems to do. It then takes the augmented key 7 characters at a time and runs it through the actual checksum, which as Nathan stated in the video just converts it from a decimal to hexidecimal (so 0000011 -> 0xB, 1122222 -> 0x111FAE etc...) - it keeps a running total but reduces it mod 0x43 after each addition. Call this final reduced total 'a'.

  if (0 < (int)(~uVar4 - 1)) {
    do {
      _strncpy((char *)local_40,(char *)((int)&local_20 + iVar10),7);
#include <print>
#include <random>
#include <string>
auto generate_random_digit() -> uint32_t {
static std::mt19937 random_generator(std::random_device{}());
static std::uniform_int_distribution<uint32_t> dist(0, 9);
return dist(random_generator);
}