BYTE status[] = {0,
//
第一个不用
0, 0, 1, 1, 0, 0, 0, 1, 1};
char name[] =
"shoooo"
;
DWORD
hash
;
BYTE key[0x1000] = {0};
DWORD keyindex = 0;
void __declspec(naked) GetHash()
{
__asm
{
pushad
mov ebp, offset name
mov ebx, 0x13572468
start:
movzx eax, byte ptr [ebp]
test
eax, eax
je end
inc ebp
add eax,ebx
imul eax,eax,0x3721273
add eax,0x24681357
mov esi,eax
shl esi,0x19
sar eax,7
or esi,eax
mov ebx,esi
jmp start
end:
mov
hash
, ebx
popad
retn
}
}
void SetStatus()
{
DWORD i;
for
(i=1; i<9; i++)
{
status[i] = (
hash
>>i) & 1;
}
status[9] = 1;
}
void turn(DWORD index)
{
DWORD i;
if
(index == 1)
{
status[1] ^= 1;
}
else
if
(index == 2)
{
if
(status[1] == 0)
turn(1);
status[2] ^= 1;
}
else
if
(index>=3 && index <=9)
{
if
(status[index-1] == 0)
turn(index-1);
for
(i=index-2;i>=1;i--)
if
(status[i] == 1)
turn(i);
status[index] ^= 1;
}
key[keyindex++] = index;
}
void main()
{
GetHash();
SetStatus();
DWORD i;
for
(i=9; i>=1; i--)
{
if
(status[i] == 1)
turn (i);
}
DWORD tmp;
for
(i=0; i<keyindex; i++)
{
tmp =
hash
;
tmp = tmp>>(i%0x1F);
tmp = tmp %10;
if
(key[i] < tmp)
key[i] += 10;
key[i] = key[i]-tmp+0x30;
}
printf
(
"%s\n"
, key);
}