看雪 2016 CTF 第二十四题 点评和解析
a4 为固定值 0x9C。
函数 sub_403910 算法思想为,a1 的每一个字节值等于 a3 的每一字节值加上 0x30(48)。
结合 sub_402E20、sub_403910 两个函数,反推注册算法,程序设计如下:
unsigned char aa[0x9c] = {0x01,0x04,0x08,0x02,0x04,0x08,0x03,0x04,0x08,0x04,0x04,0x08,0x05,0x04,0x08,0x06,
0x04,0x08,0x07,0x04,0x08,0x08,0x04,0x08,0x09,0x04,0x08,0x01,0x04,0x08,0x02,0x04,
0x08,0x03,0x04,0x08,0x04,0x04,0x08,0x05,0x04,0x08,0x06,0x04,0x08,0x07,0x04,0x08,
0x08,0x04,0x08,0x09,0x04,0x08,0x01,0x04,0x08,0x02,0x04,0x08,0x03,0x04,0x08,0x04,
0x04,0x08,0x05,0x04,0x08,0x06,0x04,0x08,0x07,0x04,0x08,0x08,0x04,0x08,0x09,0x04,
0x08,0x01,0x04,0x08,0x02,0x04,0x08,0x03,0x04,0x08,0x04,0x04,0x08,0x05,0x04,0x08,
0x06,0x04,0x08,0x07,0x04,0x08,0x08,0x04,0x08,0x09,0x04,0x08,0x01,0x04,0x08,0x02,
0x04,0x08,0x03,0x04,0x08,0x04,0x04,0x08,0x05,0x04,0x08,0x06,0x04,0x08,0x07,0x04,
0x08,0x08,0x04,0x08,0x09,0x04,0x08,0x01,0x04,0x08,0x02,0x04,0x08,0x03,0x04,0x08,
0x04,0x04,0x08,0x05,0x04,0x08,0x06,0x04,0x08,0x00,0x00,0x00};
printf("pediy");
for(int i=0;i<0x9c;i++)< p="">
{
unsigned char bb = (aa[i]+0x30)^0x86;
unsigned char cc = bb>>4;
if(cc<=9) cc+=48;
else cc+=55;
unsigned char dd = bb&0x0f;
if(dd<=9) dd+=48;
else dd+=55;
printf("%c%c",cc,dd);
}
printf("\n");
运行得到