void func6(unsigned char*mi,unsigned char*key,unsigned char*md5) {
int i;
//轮密钥加
for (i = 0; i < 0x10; i++) {
mi ^= key;
}
for (i = 1; i < 10;i++) {
func4(mi,key,i);
func5(mi); //列混淆
}
func4(mi,key,10);
for (i = 0; i < 0x10; i++) {
mi ^= md5;
}
}
[C] 纯文本查看复制代码
void func4(unsigned char*mi,unsigned char*key,int k) {
int i, j;
unsigned char a, b;
unsigned char *c,*d;
//向下列移位
/*
state’[j] = state[(4+i-j)%4][j]
*/
a = mi[9];
b = mi[0xD];
mi[0xD] = a;
a = mi[5];
mi[9] = a;
a = mi[1];
mi[5] = a;
a = mi[0xA];
mi[1] = b;
b = mi[2];
mi[2] = a;
a = mi[0xE];
mi[0xA] = b;
b = mi[6];
mi[6] = a;
a = mi[7];
mi[0xE] = b;
b = mi[3];
mi[3] = a;
a = mi[0xB];
mi[7] = a;
a = mi[0xF];
mi[0xB] = a;
mi[0xF] = b;
//字节替换
d = mi;
for (i = 0; i < 4;i++) {
c = d;
for (j = 0; j < 4;j++) {
a = *c;
c += 4;
a=table3[a];
*(c - 4) = a;
}
d++;
}
//轮密钥加
for (i = 0; i < 0x10; i++) {
mi ^= *(key-0x10*k+i);
}
}