void CCliExt::DecryptPacket(CUserSocket *pSocket, unsigned char *packet, UINT packetSize)
{
guard;
static BYTE staticKey1[8][32] = { 0x5A, 0xF8, 0xEB, 0x8E, 0x05, 0x0C, 0xC2, 0x46, 0xB4, 0xAA, 0xCC, 0x97, 0x59, 0x5A, 0x0E, 0x24, 0x27, 0xF0, 0x58, 0xE5, 0x42, 0x1E, 0xCA, 0xF6, 0x5C, 0x2C, 0xFC, 0x37, 0xB0, 0x25, 0xE3, 0x86, 0xB6, 0x38, 0x66, 0x6B, 0xF6, 0x5B, 0xC4, 0x87, 0x2D, 0x70, 0x0A, 0xF4, 0x35, 0x2E, 0x5E, 0x48, 0xAB, 0xB7, 0xA6, 0xE6, 0x87, 0xCD, 0xB0, 0xF2, 0xB1, 0xAA, 0xAD, 0x2C, 0x0C, 0xB6, 0x4C, 0xAF, 0x1C, 0x88, 0x34, 0x1D, 0x98, 0xD9, 0x08, 0x5C, 0xFD, 0x27, 0xAB, 0x05, 0x98, 0x10, 0xA8, 0x96, 0xD4, 0x9E, 0xF2, 0xFD, 0x5D, 0x90, 0xA0, 0x4B, 0xF1, 0xA6, 0xA8, 0x16, 0x7D, 0x8F, 0x58, 0x62, 0x50, 0x8C, 0x8A, 0x3D, 0xD8, 0x6D, 0xC2, 0x49, 0x81, 0x7C, 0x66, 0xBC, 0xEB, 0x13, 0xC9, 0xB6, 0x96, 0x5A, 0xA9, 0x56, 0x36, 0x74, 0xBC, 0xC1, 0x64, 0x14, 0x9B, 0x6C, 0x27, 0xEA, 0x97, 0xEC, 0x93, 0xA9, 0x2F, 0x67, 0x4D, 0x97, 0x59, 0x87, 0x44, 0xF7, 0x1D, 0x0E, 0xC2, 0x13, 0xDD, 0x75, 0x70, 0xA9, 0x16, 0xEA, 0xFC, 0xFA, 0xC7, 0xC6, 0xA0, 0xCD, 0x42, 0xED, 0x7C, 0x94, 0x66, 0xE5, 0x29, 0xEC, 0x00, 0xB9, 0x5D, 0xAE, 0x47, 0x18, 0x21, 0x88,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2f, 0xc8, 0x1d, 0x8c, 0x8, 0x7a, 0x49, 0x8d, 0xba, 0x8c, 0xbe, 0x92, 0x41, 0xe4, 0xf0, 0x47, 0x11, 0x44, 0xb2, 0xa9, 0x49, 0x75, 0x8c, 0xa6, 0x9, 0xf1, 0x38, 0x51, 0xec, 0xec, 0x5e, 0x36, 0x1f, 0xe1, 0x4c, 0xf0, 0xd4, 0x99, 0xba, 0x67, 0xb3, 0xc4, 0x5a, 0xc4, 0xe7, 0x2f, 0x4b, 0xc8, 0x7e, 0x6c, 0x16, 0x50, 0xbe, 0x5b, 0x76, 0xca, 0x17, 0x1b, 0x6c, 0x7f, 0x50, 0xeb, 0xe6, 0x3f, 0xaa, 0x8b, 0x9c, 0x7a, 0x9f, 0x96, 0x32, 0x61, 0xbf, 0x79, 0x6c, 0xee, 0x9f, 0x62, 0x8d, 0x8a, 0x27 };
UINT packetCounter = pSocket->pED->packetCounter;
if(m_Version == 1)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey1[packetCounter%8][n%32];
}
}else if(m_Version == 2)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey2[packetCounter%8][n%32];
}
}else if(m_Version == 3)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey3[packetCounter%8][n%32];
}
}else if(m_Version == 4)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey4[packetCounter%8][n%32];
}
}else if(m_Version == 5)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey5[packetCounter%8][n%32];
}
}else if(m_Version == 6)
{
for(UINT n=0;n<packetSize;n++)
{
packet[n] ^= staticKey6[packetCounter%8][n%32];
}
}else if(m_Version == 7)
{
//do nothing
}
// g_Log.Add(CLog::Blue, "[%s] pckCounter[%d] packet[%x]", __FUNCTION__, packetCounter, packet[0]);
packetCounter++;
pSocket->pED->packetCounter = packetCounter;
unguard;
}