yaa
May 1st, 2004, 19:48
Hello,
I'd need some help in reversing this algo. But apart this specific piece of code I'd like to understand how to approach similar mathematical problems.
Here is the algorithm:
What I need to obtain is obviously the value of num1.
How would you approach such a problem??? I have written a brute force app but solving it this way does not satisfy me.
yaa
I'd need some help in reversing this algo. But apart this specific piece of code I'd like to understand how to approach similar mathematical problems.
Here is the algorithm:
Code:
// num1 gets loaded with the decimal equivalent of a 16 hex digits string
ulong num1;
uint num2 = ((uint) (num1 >> 48));
if (num2 != 51712)
{
return false;
}
uint num3 = (((uint) (num1 >> 16)) & -1);
if ((num3 % 10007) != 0)
{
return false;
}
uint num4 = ((uint) (num1 & ((long) 65535)));
uint num5 = ((num2 + (num3 >> 16)) + (num3 & 65535));
num5 = ((num5 * 7) & 65535);
if (num4 != num5)
{
return false;
}
What I need to obtain is obviously the value of num1.
How would you approach such a problem??? I have written a brute force app but solving it this way does not satisfy me.
yaa