推导出给定函数Obfuscate的逆向操作函数
// =========================================================================================================
// =========================================================================================================
void Obfuscate(
const uint32_t XorKey[68],
const uint32_t Src_In[4],
uint32_t Xor_Out[4])
{
uint32_t Xor[17][4]; // 中间状态数组,Xor[0]~Xor[16]
// ------------------------ 初始轮正向操作 ------------------------
// 对原始数据应用初始轮混淆,生成Xor[0]
uint32_t temp;
// 处理第0字(Src_In[0])
temp = XorTab_00[(uint8_t)(Src_In[0] >> 0x00) & 0xFF];
temp ^= XorTab_01[(uint8_t)(Src_In[0] >> 0x08) & 0xFF];
temp ^= XorTab_02[(uint8_t)(Src_In[0] >> 0x10) & 0xFF];
temp ^= XorTab_03[(uint8_t)(Src_In[0] >> 0x18) & 0xFF];
Xor[0][0] = XorKey[0] ^ temp;
// 处理第1字(Src_In[1])
temp = XorTab_04[(uint8_t)(Src_In[1] >> 0x00) & 0xFF];
temp ^= XorTab_05[(uint8_t)(Src_In[1] >> 0x08) & 0xFF];
temp ^= XorTab_06[(uint8_t)(Src_In[1] >> 0x10) & 0xFF];
temp ^= XorTab_07[(uint8_t)(Src_In[1] >> 0x18) & 0xFF];
Xor[0][1] = XorKey[1] ^ temp;
// 处理第2字(Src_In[2])
temp = XorTab_08[(uint8_t)(Src_In[2] >> 0x00) & 0xFF];
temp ^= XorTab_09[(uint8_t)(Src_In[2] >> 0x08) & 0xFF];
temp ^= XorTab_10[(uint8_t)(Src_In[2] >> 0x10) & 0xFF];
temp ^= XorTab_11[(uint8_t)(Src_In[2] >> 0x18) & 0xFF];
Xor[0][2] = XorKey[2] ^ temp;
// 处理第3字(Src_In[3])
temp = XorTab_12[(uint8_t)(Src_In[3] >> 0x00) & 0xFF];
temp ^= XorTab_13[(uint8_t)(Src_In[3] >> 0x08) & 0xFF];
temp ^= XorTab_14[(uint8_t)(Src_In[3] >> 0x10) & 0xFF];
temp ^= XorTab_15[(uint8_t)(Src_In[3] >> 0x18) & 0xFF];
Xor[0][3] = XorKey[3] ^ temp;
//printf("Round00-Xor[00]:|%08X|%08X|%08X|%08X|\r\n", Xor[0][0],Xor[0][1],Xor[0][2],Xor[0][3]);
// ------------------------ 第1轮正向操作 ------------------------
// 从Xor[0]计算Xor[1]
temp = XorTab_16[(uint8_t)(Xor[0][0] >> 0x00) & 0xFF];
temp ^= XorTab_17[(uint8_t)(Xor[0][0] >> 0x08) & 0xFF];
temp ^= XorTab_18[(uint8_t)(Xor[0][0] >> 0x10) & 0xFF];
temp ^= XorTab_19[(uint8_t)(Xor[0][0] >> 0x18) & 0xFF];
Xor[1][0] = XorKey[4] ^ temp;
temp = XorTab_20[(uint8_t)(Xor[0][1] >> 0x00) & 0xFF];
temp ^= XorTab_21[(uint8_t)(Xor[0][1] >> 0x08) & 0xFF];
temp ^= XorTab_22[(uint8_t)(Xor[0][1] >> 0x10) & 0xFF];
temp ^= XorTab_23[(uint8_t)(Xor[0][1] >> 0x18) & 0xFF];
Xor[1][1] = XorKey[5] ^ temp;
temp = XorTab_24[(uint8_t)(Xor[0][2] >> 0x00) & 0xFF];
temp ^= XorTab_25[(uint8_t)(Xor[0][2] >> 0x08) & 0xFF];
temp ^= XorTab_26[(uint8_t)(Xor[0][2] >> 0x10) & 0xFF];
temp ^= XorTab_27[(uint8_t)(Xor[0][2] >> 0x18) & 0xFF];
Xor[1][2] = XorKey[6] ^ temp;
temp = XorTab_28[(uint8_t)(Xor[0][3] >> 0x00) & 0xFF];
temp ^= XorTab_29[(uint8_t)(Xor[0][3] >> 0x08) & 0xFF];
temp ^= XorTab_30[(uint8_t)(Xor[0][3] >> 0x10) & 0xFF];
temp ^= XorTab_31[(uint8_t)(Xor[0][3] >> 0x18) & 0xFF];
Xor[1][3] = XorKey[7] ^ temp;
//printf("Round01-Xor[01]:|%08X|%08X|%08X|%08X|\r\n", Xor[1][0],Xor[1][1],Xor[1][2],Xor[1][3]);
// ------------------------ 第2轮正向操作 ------------------------
temp = XorTab_32[(uint8_t)(Xor[1][0] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[1][1] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[1][2] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[1][3] >> 0x08) & 0xFF];
Xor[2][0] = XorKey[8] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[1][1] >> 0x00) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[1][0] >> 0x08) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[1][2] >> 0x18) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[1][3] >> 0x10) & 0xFF];
Xor[2][1] = XorKey[9] ^ temp;
temp = XorTab_40[(uint8_t)(Xor[1][2] >> 0x00) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[1][0] >> 0x10) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[1][1] >> 0x08) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[1][3] >> 0x18) & 0xFF];
Xor[2][2] = XorKey[10] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[1][3] >> 0x00) & 0xFF];
temp ^= XorTab_45[(uint8_t)(Xor[1][0] >> 0x18) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[1][1] >> 0x10) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[1][2] >> 0x08) & 0xFF];
Xor[2][3] = XorKey[11] ^ temp;
//printf("Round02-Xor[2]:|%08X|%08X|%08X|%08X|\r\n", Xor[2][0],Xor[2][1],Xor[2][2],Xor[2][3]);
// ------------------------ 第3轮正向操作 ------------------------
temp = XorTab_48[(uint8_t)(Xor[2][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[2][3] >> 0x08) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[2][2] >> 0x10) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[2][1] >> 0x18) & 0xFF];
Xor[3][0] = XorKey[12] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[2][1] >> 0x00) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[2][3] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[2][0] >> 0x08) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[2][2] >> 0x18) & 0xFF];
Xor[3][1] = XorKey[13] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[2][2] >> 0x00) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[2][3] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[2][0] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[2][1] >> 0x08) & 0xFF];
Xor[3][2] = XorKey[14] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[2][3] >> 0x00) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[2][1] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[2][0] >> 0x18) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[2][2] >> 0x08) & 0xFF];
Xor[3][3] = XorKey[15] ^ temp;
//printf("Round03-Xor[3]:|%08X|%08X|%08X|%08X|\r\n", Xor[3][0],Xor[3][1],Xor[3][2],Xor[3][3]);
// ------------------------ 第4轮正向操作 ------------------------
temp = XorTab_48[(uint8_t)(Xor[3][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[3][3] >> 0x08) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[3][1] >> 0x18) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[3][2] >> 0x10) & 0xFF];
Xor[4][0] = XorKey[16] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[3][1] >> 0x00) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[3][0] >> 0x08) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[3][3] >> 0x10) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[3][2] >> 0x18) & 0xFF];
Xor[4][1] = XorKey[17] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[3][2] >> 0x00) & 0xFF];
temp ^= XorTab_45[(uint8_t)(Xor[3][3] >> 0x18) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[3][1] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[3][0] >> 0x10) & 0xFF];
Xor[4][2] = XorKey[18] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[3][3] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[3][0] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[3][1] >> 0x10) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[3][2] >> 0x08) & 0xFF];
Xor[4][3] = XorKey[19] ^ temp;
//printf("Round04-Xor[4]:|%08X|%08X|%08X|%08X|\r\n", Xor[4][0],Xor[4][1],Xor[4][2],Xor[4][3]);
// ------------------------ 第5轮正向操作 ------------------------
temp = XorTab_40[(uint8_t)(Xor[4][0] >> 0x00) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[4][3] >> 0x08) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[4][1] >> 0x18) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[4][2] >> 0x10) & 0xFF];
Xor[5][0] = XorKey[20] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[4][1] >> 0x00) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[4][3] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[4][0] >> 0x08) & 0xFF];
temp ^= XorTab_45[(uint8_t)(Xor[4][2] >> 0x18) & 0xFF];
Xor[5][1] = XorKey[21] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[4][2] >> 0x00) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[4][0] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[4][3] >> 0x18) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[4][1] >> 0x08) & 0xFF];
Xor[5][2] = XorKey[22] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[4][3] >> 0x00) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[4][0] >> 0x18) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[4][1] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[4][2] >> 0x08) & 0xFF];
Xor[5][3] = XorKey[23] ^ temp;
//printf("Round05-Xor[5]:|%08X|%08X|%08X|%08X|\r\n", Xor[5][0],Xor[5][1],Xor[5][2],Xor[5][3]);
// ------------------------ 第6轮正向操作 ------------------------
temp = XorTab_44[(uint8_t)(Xor[5][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[5][3] >> 0x08) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[5][2] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[5][1] >> 0x18) & 0xFF];
Xor[6][0] = XorKey[24] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[5][1] >> 0x00) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[5][3] >> 0x10) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[5][0] >> 0x08) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[5][2] >> 0x18) & 0xFF];
Xor[6][1] = XorKey[25] ^ temp;
temp = XorTab_40[(uint8_t)(Xor[5][2] >> 0x00) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[5][3] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[5][0] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[5][1] >> 0x08) & 0xFF];
Xor[6][2] = XorKey[26] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[5][3] >> 0x00) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[5][0] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[5][1] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[5][2] >> 0x08) & 0xFF];
Xor[6][3] = XorKey[27] ^ temp;
//printf("Round06-Xor[6]:|%08X|%08X|%08X|%08X|\r\n", Xor[6][0],Xor[6][1],Xor[6][2],Xor[6][3]);
// ------------------------ 第7轮正向操作 ------------------------
temp = XorTab_32[(uint8_t)(Xor[6][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[6][3] >> 0x08) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[6][1] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[6][2] >> 0x10) & 0xFF];
Xor[7][0] = XorKey[28] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[6][1] >> 0x00) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[6][0] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[6][3] >> 0x10) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[6][2] >> 0x18) & 0xFF];
Xor[7][1] = XorKey[29] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[6][2] >> 0x00) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[6][3] >> 0x18) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[6][1] >> 0x08) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[6][0] >> 0x10) & 0xFF];
Xor[7][2] = XorKey[30] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[6][3] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[6][0] >> 0x18) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[6][2] >> 0x08) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[6][1] >> 0x10) & 0xFF];
Xor[7][3] = XorKey[31] ^ temp;
//printf("Round07-Xor[7]:|%08X|%08X|%08X|%08X|\r\n", Xor[7][0],Xor[7][1],Xor[7][2],Xor[7][3]);
// ------------------------ 第8轮正向操作 ------------------------
temp = XorTab_36[(uint8_t)(Xor[7][0] >> 0x00) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[7][3] >> 0x08) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[7][1] >> 0x18) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[7][2] >> 0x10) & 0xFF];
Xor[8][0] = XorKey[32] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[7][1] >> 0x00) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[7][0] >> 0x08) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[7][3] >> 0x10) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[7][2] >> 0x18) & 0xFF];
Xor[8][1] = XorKey[33] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[7][2] >> 0x00) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[7][3] >> 0x18) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[7][1] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[7][0] >> 0x10) & 0xFF];
Xor[8][2] = XorKey[34] ^ temp;
temp = XorTab_40[(uint8_t)(Xor[7][3] >> 0x00) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[7][1] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[7][0] >> 0x18) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[7][2] >> 0x08) & 0xFF];
Xor[8][3] = XorKey[35] ^ temp;
//printf("Round08-Xor[8]:|%08X|%08X|%08X|%08X|\r\n", Xor[8][0],Xor[8][1],Xor[8][2],Xor[8][3]);
// ------------------------ 第9轮正向操作 ------------------------
temp = XorTab_36[(uint8_t)(Xor[8][0] >> 0x00) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[8][3] >> 0x08) & 0xFF];
temp ^= XorTab_45[(uint8_t)(Xor[8][1] >> 0x18) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[8][2] >> 0x10) & 0xFF];
Xor[9][0] = XorKey[36] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[8][1] >> 0x00) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[8][0] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[8][3] >> 0x10) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[8][2] >> 0x18) & 0xFF];
Xor[9][1] = XorKey[37] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[8][2] >> 0x00) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[8][3] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[8][0] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[8][1] >> 0x08) & 0xFF];
Xor[9][2] = XorKey[38] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[8][3] >> 0x00) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[8][0] >> 0x18) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[8][2] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[8][1] >> 0x10) & 0xFF];
Xor[9][3] = XorKey[39] ^ temp;
//printf("Round09-Xor[9]:|%08X|%08X|%08X|%08X|\r\n", Xor[9][0],Xor[9][1],Xor[9][2],Xor[9][3]);
// ------------------------ 第10轮正向操作 ------------------------
temp = XorTab_44[(uint8_t)(Xor[9][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[9][3] >> 0x08) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[9][1] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[9][2] >> 0x10) & 0xFF];
Xor[10][0] = temp ^ XorKey[40];
temp = XorTab_48[(uint8_t)(Xor[9][1] >> 0x00) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[9][3] >> 0x10) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[9][0] >> 0x08) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[9][2] >> 0x18) & 0xFF];
Xor[10][1] = temp ^ XorKey[41];
temp = XorTab_36[(uint8_t)(Xor[9][2] >> 0x00) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[9][3] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[9][0] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[9][1] >> 0x08) & 0xFF];
Xor[10][2] = temp ^ XorKey[42];
temp = XorTab_36[(uint8_t)(Xor[9][3] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[9][0] >> 0x18) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[9][2] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[9][1] >> 0x10) & 0xFF];
Xor[10][3] = temp ^ XorKey[43];
//printf("Round10-Xor[10]:|%08X|%08X|%08X|%08X|\r\n", Xor[10][0],Xor[10][1],Xor[10][2],Xor[10][3]);
// ------------------------ 第11轮正向操作 ------------------------
temp = XorTab_32[(uint8_t)(Xor[10][0] >> 0x00) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[10][3] >> 0x08) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[10][1] >> 0x18) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[10][2] >> 0x10) & 0xFF];
Xor[11][0] = XorKey[44] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[10][1] >> 0x00) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[10][3] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[10][0] >> 0x08) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[10][2] >> 0x18) & 0xFF];
Xor[11][1] = XorKey[45] ^ temp;
temp = XorTab_44[(uint8_t)(Xor[10][2] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[10][3] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[10][0] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[10][1] >> 0x08) & 0xFF];
Xor[11][2] = XorKey[46] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[10][3] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[10][0] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[10][1] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[10][2] >> 0x08) & 0xFF];
Xor[11][3] = XorKey[47] ^ temp;
//printf("Round11-Xor[11]:|%08X|%08X|%08X|%08X|\r\n", Xor[11][0],Xor[11][1],Xor[11][2],Xor[11][3]);
// ------------------------ 第12轮正向操作 ------------------------
temp = XorTab_48[(uint8_t)(Xor[11][0] >> 0x00) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[11][3] >> 0x08) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[11][1] >> 0x18) & 0xFF];
temp ^= XorTab_39[(uint8_t)(Xor[11][2] >> 0x10) & 0xFF];
Xor[12][0] = temp ^ XorKey[48];
temp = XorTab_44[(uint8_t)(Xor[11][1] >> 0x00) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[11][3] >> 0x10) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[11][0] >> 0x08) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[11][2] >> 0x18) & 0xFF];
Xor[12][1] = temp ^ XorKey[49];
temp = XorTab_36[(uint8_t)(Xor[11][2] >> 0x00) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[11][3] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[11][0] >> 0x10) & 0xFF];
temp ^= XorTab_35[(uint8_t)(Xor[11][1] >> 0x08) & 0xFF];
Xor[12][2] = temp ^ XorKey[50];
temp = XorTab_48[(uint8_t)(Xor[11][3] >> 0x00) & 0xFF];
temp ^= XorTab_38[(uint8_t)(Xor[11][0] >> 0x18) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[11][1] >> 0x10) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[11][2] >> 0x08) & 0xFF];
Xor[12][3] = temp ^ XorKey[51];
//printf("Round12-Xor[12]:|%08X|%08X|%08X|%08X|\r\n", Xor[12][0],Xor[12][1],Xor[12][2],Xor[12][3]);
// ------------------------ 第13轮正向操作 ------------------------
temp = XorTab_44[(uint8_t)(Xor[12][0] >> 0x00) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[12][3] >> 0x08) & 0xFF];
temp ^= XorTab_45[(uint8_t)(Xor[12][1] >> 0x18) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[12][2] >> 0x10) & 0xFF];
Xor[13][0] = temp ^ XorKey[52];
temp = XorTab_32[(uint8_t)(Xor[12][1] >> 0x00) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[12][0] >> 0x08) & 0xFF];
temp ^= XorTab_34[(uint8_t)(Xor[12][3] >> 0x10) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[12][2] >> 0x18) & 0xFF];
Xor[13][1] = temp ^ XorKey[53];
temp = XorTab_44[(uint8_t)(Xor[12][3] >> 0x00) & 0xFF];
temp ^= XorTab_46[(uint8_t)(Xor[12][1] >> 0x10) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[12][0] >> 0x18) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[12][2] >> 0x08) & 0xFF];
Xor[13][2] = temp ^ XorKey[55];
temp = XorTab_40[(uint8_t)(Xor[12][2] >> 0x00) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[12][0] >> 0x10) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[12][3] >> 0x18) & 0xFF];
temp ^= XorTab_42[(uint8_t)(Xor[12][1] >> 0x08) & 0xFF];
Xor[13][3] = temp ^ XorKey[54];
//printf("Round13-Xor[13]:|%08X|%08X|%08X|%08X|\r\n", Xor[13][0],Xor[13][1],Xor[13][2],Xor[13][3]);
// ------------------------ 第14轮正向操作 ------------------------
temp = XorTab_40[(uint8_t)(Xor[13][0] >> 0x00) & 0xFF];
temp ^= XorTab_49[(uint8_t)(Xor[13][2] >> 0x08) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[13][3] >> 0x10) & 0xFF];
temp ^= XorTab_43[(uint8_t)(Xor[13][1] >> 0x18) & 0xFF];
Xor[14][0] = XorKey[56] ^ temp;
temp = XorTab_36[(uint8_t)(Xor[13][1] >> 0x00) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[13][0] >> 0x08) & 0xFF];
temp ^= XorTab_50[(uint8_t)(Xor[13][2] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[13][3] >> 0x18) & 0xFF];
Xor[14][1] = XorKey[57] ^ temp;
temp = XorTab_48[(uint8_t)(Xor[13][3] >> 0x00) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[13][0] >> 0x10) & 0xFF];
temp ^= XorTab_51[(uint8_t)(Xor[13][2] >> 0x18) & 0xFF];
temp ^= XorTab_47[(uint8_t)(Xor[13][1] >> 0x08) & 0xFF];
Xor[14][2] = XorKey[58] ^ temp;
temp = XorTab_32[(uint8_t)(Xor[13][2] >> 0x00) & 0xFF];
temp ^= XorTab_33[(uint8_t)(Xor[13][0] >> 0x18) & 0xFF];
temp ^= XorTab_41[(uint8_t)(Xor[13][1] >> 0x10) & 0xFF];
temp ^= XorTab_37[(uint8_t)(Xor[13][3] >> 0x08) & 0xFF];
Xor[14][3] = XorKey[59] ^ temp;
//printf("Round14-Xor[14]:|%08X|%08X|%08X|%08X|\r\n", Xor[14][0],Xor[14][1],Xor[14][2],Xor[14][3]);
// ------------------------ 第15轮正向操作 ------------------------
temp = XorTab_52[(uint8_t)(Xor[14][0] >> 0x00) & 0xFF];
temp ^= XorTab_53[(uint8_t)(Xor[14][1] >> 0x18) & 0xFF];
temp ^= XorTab_54[(uint8_t)(Xor[14][3] >> 0x08) & 0xFF];
temp ^= XorTab_55[(uint8_t)(Xor[14][2] >> 0x10) & 0xFF];
Xor[15][0] = XorKey[60] ^ temp;
temp = XorTab_56[(uint8_t)(Xor[14][1] >> 0x00) & 0xFF];
temp ^= XorTab_57[(uint8_t)(Xor[14][0] >> 0x08) & 0xFF];
temp ^= XorTab_58[(uint8_t)(Xor[14][3] >> 0x10) & 0xFF];
temp ^= XorTab_59[(uint8_t)(Xor[14][2] >> 0x18) & 0xFF];
Xor[15][1] = XorKey[61] ^ temp;
temp = XorTab_60[(uint8_t)(Xor[14][2] >> 0x00) & 0xFF];
temp ^= XorTab_63[(uint8_t)(Xor[14][1] >> 0x08) & 0xFF];
temp ^= XorTab_62[(uint8_t)(Xor[14][0] >> 0x10) & 0xFF];
temp ^= XorTab_61[(uint8_t)(Xor[14][3] >> 0x18) & 0xFF];
Xor[15][2] = XorKey[62] ^ temp;
temp = XorTab_64[(uint8_t)(Xor[14][3] >> 0x00) & 0xFF];
temp ^= XorTab_65[(uint8_t)(Xor[14][0] >> 0x18) & 0xFF];
temp ^= XorTab_66[(uint8_t)(Xor[14][1] >> 0x10) & 0xFF];
temp ^= XorTab_67[(uint8_t)(Xor[14][2] >> 0x08) & 0xFF];
Xor[15][3] = XorKey[63] ^ temp;
//printf("Round15-Xor[15]:|%08X|%08X|%08X|%08X|\r\n", Xor[15][0],Xor[15][1],Xor[15][2],Xor[15][3]);
// ------------------------ 第16轮正向操作 ------------------------
temp = XorTab_68[(uint8_t)(Xor[15][0] >> 0x00) & 0xFF];
temp ^= XorTab_69[(uint8_t)(Xor[15][0] >> 0x08) & 0xFF];
temp ^= XorTab_70[(uint8_t)(Xor[15][0] >> 0x10) & 0xFF];
temp ^= XorTab_71[(uint8_t)(Xor[15][0] >> 0x18) & 0xFF];
Xor[16][0] = XorKey[64] ^ temp;
temp = XorTab_72[(uint8_t)(Xor[15][1] >> 0x00) & 0xFF];
temp ^= XorTab_73[(uint8_t)(Xor[15][1] >> 0x08) & 0xFF];
temp ^= XorTab_74[(uint8_t)(Xor[15][1] >> 0x10) & 0xFF];
temp ^= XorTab_75[(uint8_t)(Xor[15][1] >> 0x18) & 0xFF];
Xor[16][1] = XorKey[65] ^ temp;
temp = XorTab_76[(uint8_t)(Xor[15][2] >> 0x00) & 0xFF];
temp ^= XorTab_77[(uint8_t)(Xor[15][2] >> 0x08) & 0xFF];
temp ^= XorTab_78[(uint8_t)(Xor[15][2] >> 0x10) & 0xFF];
temp ^= XorTab_79[(uint8_t)(Xor[15][2] >> 0x18) & 0xFF];
Xor[16][2] = XorKey[66] ^ temp;
temp = XorTab_80[(uint8_t)(Xor[15][3] >> 0x00) & 0xFF];
temp ^= XorTab_81[(uint8_t)(Xor[15][3] >> 0x08) & 0xFF];
temp ^= XorTab_82[(uint8_t)(Xor[15][3] >> 0x10) & 0xFF];
temp ^= XorTab_83[(uint8_t)(Xor[15][3] >> 0x18) & 0xFF];
Xor[16][3] = XorKey[67] ^ temp;
//printf("Round16-Xor[16]:|%08X|%08X|%08X|%08X|\r\n", Xor[16][0],Xor[16][1],Xor[16][2],Xor[16][3]);
// ------------------------ 输出混淆结果 ------------------------
Xor_Out[0] = Xor[16][0];
Xor_Out[1] = Xor[16][1];
Xor_Out[2] = Xor[16][2];
Xor_Out[3] = Xor[16][3];
}
最新发布