#include<stdio.h>
#include<string.h>
#define LENGTH 6
int main(void)
{
char Name[LENGTH] = "erfze";
int i, chr=0,res=0;
for (i = 0; i < strlen(Name); ++i)
{
chr = Name[i];
if (chr > 'A' && chr < 'Z')
continue;
else
chr = chr - 0x20;
Name[i] = chr;
res += chr;
}
res ^= 0x5678;
}
0x03 F2(Key)算法分析
Ctrl+G输入04013D8来到子程序入口处:
下面是笔者在分析算法时所作记录:
根据上述分析,粗略写出C语言实现代码:
#include<stdio.h>
#include<string.h>
#define LENGTH 6
int main(void)
{
char Key[LENGTH] = "12345";
int i, a = 0xA, d = 0,chr=0;
for (i = 0; i < strlen(Key); ++i)
{
chr = Key[i]-0x30;
d = d * a + chr;
}
d ^= 0x1234;
}
0x04 编写KeyGen
0x03中:
for (i = 0; i < strlen(Key); ++i)
{
chr = Key[i]-0x30;
d = d * a + chr;
}