I've recently gotten into reversing crackmes, and I seem to always fail at the ones similar to this.
The final key that the program uses for comparison is not the key that should be used as input, the key used as input is used in an algorithm with another set of data to check if it generates the final key. Here is the code so it makes a bit more sense.
signed __int64 __fastcall ValidateSerials(unsigned int *generatedData, unsigned int *finalCorrectSerial, unsigned int *UserInputSerial)
{
signed int i; // [rsp+0h] [rbp-18h]
signed int j; // [rsp+4h] [rbp-14h]
signed int currentUserInputsr; // [rsp+8h] [rbp-10h]
int v7; // [rsp+Ch] [rbp-Ch]
for ( i = 0; i < 4; ++i )
{
v7 = 0;
currentUserInputsr = UserInputSerial[i];
for ( j = 6; j >= 0; --j )
{
v7 += generatedData[j] * (currentUserInputsr & 1);
currentUserInputsr >>= 1;
}
if ( v7 != finalCorrectSerial[i] )
return 0i64;
}
return 1i64;
}
if I know generatedData
and finalCorrectSerial
, how can I generate the correct UserInputSerial
? I've tried to reverse the entire functions logic but I always get it wrong. I'm fairly new into solving keygens such as this but not reverse engineering in general.
Thanks