28-01-2013, 06:56 AM
Hi I want to start out learning to write a small game server in C + +
But I get the not Decrypt Session
My code
Hope someone can help me
Ps: Sorry for my bad english
But I get the not Decrypt Session
My code
Codice:
int iSessionID; // for SessionID
std::string sSessionID = DecryptSessionPacket(Recv); // save Decrypt SessionID
std::vector<std::string> pSessionID = split(sSessionID.c_str(), ' '); // Split sSessionID and save on vector
std::stringstream ss(pSessionID[1].c_str()); // save result from pSessionID
ss >> iSessionID; // convert string to int
std::cout << iSessionID << std::endl; // replay iSessionID
But it does not want to play the session
NosTale has one new decryption / encryption?
This is my SessionPacketDecrpytion of Trollface
std::string DecryptSessionPacket(std::string str)
{
std::string encrypted_string;
for (int i = 1; i < str.length(); i++)
{
if (str[i] == 0xE) { return encrypted_string; }
unsigned char firstbyte = str[i] - 0xF;
unsigned char secondbyte = firstbyte;
secondbyte &= 0xF0;
firstbyte = firstbyte - secondbyte;
secondbyte >>= 0x4;
switch (secondbyte)
{
case 0:
encrypted_string += ' ';
break;
case 1:
encrypted_string += ' ';
break;
case 2:
encrypted_string += '-';
break;
case 3:
encrypted_string += '.';
break;
default:
secondbyte += 0x2C;
encrypted_string += secondbyte;
break;
}
switch (firstbyte)
{
case 0:
encrypted_string += ' ';
break;
case 1:
encrypted_string += ' ';
break;
case 2:
encrypted_string += '-';
break;
case 3:
encrypted_string += '.';
break;
default:
firstbyte += 0x2C;
encrypted_string += firstbyte;
break;
}
}
return encrypted_string;
}
Ps: Sorry for my bad english