public unsafe void Transform(byte[] data) { if (data.Length > 32000) { inGame = true; } if (!inGame) { aesCipher.Transform(data, iv); } else { aesCipher.SimpleSubtractDecode(data, iv); } byte[] newIV = { 0xF2, 0x53, 0x50, 0xC6 }; for (int i = 0; i < IV_LENGTH; i++) { byte input = iv[i]; byte tableInput = shiftKey[input]; newIV[0] += (byte)(shiftKey[newIV[1]] - input); newIV[1] -= (byte)(newIV[2] ^ tableInput); newIV[2] ^= (byte)(shiftKey[newIV[3]] + input); newIV[3] -= (byte)(newIV[0] - tableInput); fixed(byte *ptr = newIV) * (uint *)ptr = (*(uint *)ptr << 3) | (*(uint *)ptr >> 32 - 3); //RC6 ROL 3 } Buffer.BlockCopy(newIV, 0, iv, 0, IV_LENGTH); }
public unsafe void Transform(byte[] data) { aesCipher.Transform(data, iv); byte[] newIV = { 0xF2, 0x53, 0x50, 0xC6 }; for (int i = 0; i < IV_LENGTH; i++) { byte input = iv[i]; byte tableInput = shiftKey[input]; newIV[0] += (byte)(shiftKey[newIV[1]] - input); newIV[1] -= (byte)(newIV[2] ^ tableInput); newIV[2] ^= (byte)(shiftKey[newIV[3]] + input); newIV[3] -= (byte)(newIV[0] - tableInput); fixed(byte *ptr = newIV) * (uint *)ptr = (*(uint *)ptr << 3) | (*(uint *)ptr >> 32 - 3); //RC6 ROL 3 } Buffer.BlockCopy(newIV, 0, iv, 0, IV_LENGTH); }