这个问题比编程问题更数学化。我有解码许可证密钥并检查其正确性的功能。
见代码:
ushort local6 = rand1; // generated random = 0x2ff2
ushort local1 = rand2; // = 0x780e
ushort local8 = rand3; // = 0x1e3c
ushort local4 = rand4; // = 0xf521
ushort temp1 = 0; // always zero
ushort temp2 = 0; // always zero
// THIS loop
for (int i = 0; i < 8; i++)
{
local6 += stack2[0 + 6 * i];
local1 += stack2[1 + 6 * i];
local8 += stack2[2 + 6 * i];
local4 += stack2[3 + 6 * i];
temp1 = (ushort)(local6 ^ local8);
temp1 += stack2[4 + 6 * i];
temp2 = (ushort)((local1 ^ local4) + temp1);
temp2 += stack2[5 + 6 * i];
temp1 += temp2;
local6 = (ushort)(local6 ^ temp2);
local4 ^= temp1;
temp1 ^= local1;
local1 = (ushort)(local8 ^ temp2);
local8 = temp1;
}
// Results after loop:
// local6 = 0x518a
// local1 = 0x33e5
// local8 = 0x8bca
// local4 = 0x57de
// validate date, checksums etc.
if (_validate(local6, local8, local1, local4))
return "Key " + rand1 + "-" + "rand2" + "-" + "rand3" + "-" + "rand4" + " is valid!";
else
return "Key invalid!";
为了使它更简单,让我们假设:
ushort[] stack2 = new ushort[52];
for (int i = 0; i < stack2.Length; i++)
{
stack2[i] = (ushort)i;
}
问题是;这个循环是可逆的吗?我的意思是是否可以检索值
rand1, rand2, rand3, rand4
从循环后获取的值:
local6, local1, local8, local4
了解循环函数的代码?我几乎可以肯定这是不可能的,但想知道您对此有何看法。
我分享的代码是我的发明,我真的相信这种循环可以很好地保护逆向工程师(串行破解者),除非他们暴力破解。