Dato che ci sono più discussioni a riguardo ma incomplete,
apro questa discussione dove posto tutte le crittografie di nostale..
posto sia quelle in NET che quelle in C++ (alcune fatte da me, alcune fatte da altri)
Login Decryption (Ð3V!L, C++)
Codice:
std::string loginDecrypt(std::string str)
{
std::string dec_str;
for (int i = 0; i < str.size(); i++) { dec_str += str[i] - 0xF ^ 0xC3; }
return dec_str;
}
Login Encryption (trollface, C++)
Codice:
std::string EncryptLoginPacket(std::string str)
{
std::string encrypted_string;
for (int i = 0; i < str.length(); i++) { encrypted_string += str[i] + 0xF; }
return encrypted_string += 0x19;
}
Password Hash Decryption (Ð3V!L, C++) -- BUG FIXED
Codice:
std::string LoginPassDecrypt(std::string tmp)
{
try
{
bool equal = tmp.size() % 2 == 0 ? true : false;
std::string str = equal == true ? tmp.erase(0,3) : tmp.erase(0, 4);
std::string dec_pass;
for(int i = 0; i < str.size(); i += 2) { dec_pass += str[i]; }
if(dec_pass.size() % 2 != 0)
{
str.clear();
dec_pass.clear();
str = tmp.erase(0, 2);
for(int i = 0; i < str.size(); i += 2) { dec_pass += str[i]; }
}
std::string temp = dec_pass;
dec_pass.clear();
for(int i = 0; i < temp.size(); i++)
{
dec_pass += temp[i];
if (i % 2 && i != 0) dec_pass += " ";
}
std::stringstream ss(dec_pass);
dec_pass.clear();
int convert;
while ( ss >> std::hex >> convert)
{
dec_pass.push_back(convert);
}
return dec_pass;
}
catch (...)
{
return "-1";
}
}
Session Packet Decryption (trollface, C++)
Codice:
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;
}
Game Packet Decryption (Part 1) (trollface, C++)
Codice:
std::string DecryptGamePacket(int session_id, unsigned char *str, int length)
{
std::string encrypted_string = "";
int session_key = session_id & 0xFF;
unsigned char session_number = session_id >> 6;
session_number &= 0xFF;
session_number &= 0x80000003;
switch (session_number)
{
case 0:
for (int i = 0; i < length; i++)
{
unsigned char firstbyte = session_key + 0x40;
unsigned char highbyte = str[i] - firstbyte;
encrypted_string += highbyte;
}
break;
case 1:
for (int i = 0; i < length; i++)
{
unsigned char firstbyte = session_key + 0x40;
unsigned char highbyte = str[i] + firstbyte;
encrypted_string += highbyte;
}
break;
case 2:
for (int i = 0; i < length; i++)
{
unsigned char firstbyte = session_key + 0x40;
unsigned char highbyte = str[i] - firstbyte ^ 0xC3;
encrypted_string += highbyte;
}
break;
case 3:
for (int i = 0; i < length; i++)
{
unsigned char firstbyte = session_key + 0x40;
unsigned char highbyte = str[i] + firstbyte ^ 0xC3;
encrypted_string += highbyte;
}
break;
default:
encrypted_string += 0xF;
break;
}
std::vector<std::string> temp = split(encrypted_string, 0xFF);
std::string save = "";
for (int i = 0; i < temp.size(); i++)
{
save += DecryptGamePacket2(temp[i].c_str());
save += 0xFF;
}
return save;
}
Game Packet Decryption (Part 2) (trollface, C++)
Codice:
std::string DecryptGamePacket2(unsigned char str[])
{
std::string decrypted_string;
char table[] = {' ','-','.','0','1','2','3','4','5','6','7','8','9','n'};
int count = 0;
for (count = 0; count < strlen(str); )
{
if (str[count] <= 0x7A)
{
unsigned char len = str[count];
for (int i = 0; i < (int)len; i++)
{
count++;
decrypted_string += str[count] ^ 0xFF;
}
count++;
} else
{
unsigned char len = str[count];
len &= 0x7F;
for (int i = 0; i < (int)len;)
{
count++;
unsigned char highbyte = str[count];
highbyte &= 0xF0;
highbyte >>= 0x4;
unsigned char lowbyte = str[count];
lowbyte &= 0x0F;
if (highbyte != 0x0 && highbyte != 0xF)
{
decrypted_string += table[highbyte-1];
i++;
}
if (lowbyte != 0x0 && lowbyte != 0xF)
{
decrypted_string += table[lowbyte-1];
i++;
}
}
count ++;
}
}
return decrypted_string;
}
Game Packet Encrypt (trollface, C++)
Codice:
std::string EncryptGamePacket(string str)
{
std::string encrypted_string;
std::vector<std::string> buffer;
buffer = split(str, ' ');
encrypted_string += buffer[0].length();
for (int i = 0 ; i < str.length(); i++)
{
if (i == buffer[0].length())
{
int size = str.length() - buffer[0].length();
encrypted_string += size;
}
encrypted_string += str[i] ^ 0xFF;
}
return encrypted_string += 0xFF;
}
Login Packet Decrypt (Ð3V!L, C#)
Codice:
public static string LoginDecrypt(byte[] tmp, int size)
{
try
{
for (int i = 0; i < size; i++)
{
tmp[i] = (byte)(tmp[i] - 0xF ^ 0xC3);
}
return Encoding.ASCII.GetString(tmp).Substring(0, size);
}
catch
{
return "error";
}
}
Login Packet Encrypt (Ð3V!L, C#)
Codice:
public static byte[] LoginEncrypt(string str)
{
try
{
str += " ";
byte[] tmp = new byte[str.Length + 1];
tmp = Encoding.ASCII.GetBytes(str);
for (int i = 0; i < str.Length; i++)
{
tmp[i] = Convert.ToByte(str[i] + 15);
}
tmp[tmp.Length-1] = 25;
return tmp;
}
catch
{
return new byte[0];
}
}
Password Hash Decrypt (Ð3V!L, C#) -- BUG FIXED
Codice:
public static string LoginPassDecrypt(string tmp)
{
try
{
bool equal = tmp.Length % 2 == 0 ? true : false;
string str = equal == true ? tmp.Remove(0, 3) : tmp.Remove(0, 4);
string dec_pass = string.Empty;
for (int i = 0; i < str.Length; i += 2) { dec_pass += str[i]; }
if (dec_pass.Length % 2 != 0)
{
str = dec_pass = string.Empty;
str = tmp.Remove(0, 2);
for (int i = 0; i < str.Length; i += 2) { dec_pass += str[i]; }
}
StringBuilder temp = new StringBuilder();
for (int i = 0; i < dec_pass.Length; i += 2) { temp.Append(Convert.ToChar(Convert.ToUInt32(dec_pass.Substring(i, 2), 16))); }
dec_pass = temp.ToString();
return dec_pass;
}
catch
{
return "-1";
}
}
Game Session Decrypt (Ð3V!L, C#) -- OLD CLIENT
Codice:
public static byte[] GameSessionDecrypt(byte[] data)
{
try
{
byte[] tmp = new byte[data.Length];
for(int i = 0; i < data.Length; i++)
tmp[i] = (byte)(data[i] - 0x0F);
return tmp;
}
catch
{
return new byte[0];
}
}
la discussione è in continuo aggiornamento..