public void Decrypt(Client client) { var length = Data.Length - 3; var bRand = (ushort)((Data[length + 2] << 8 | Data[length]) ^ 0x7470); var sRand = (byte)(Data[length + 1] ^ 0x23); var key = (UseDefaultKey) ? client.EncryptionKey : client.GenerateKey(bRand, sRand); for (var i = 0; i < length; i++) { Data[i] ^= key[i % key.Length]; Data[i] ^= SaltTable[client.EncryptionSeed][(i / key.Length) % SaltTable[client.EncryptionSeed].Length]; if ((i / key.Length) % SaltTable[client.EncryptionSeed].Length != Ordinal) { Data[i] ^= SaltTable[client.EncryptionSeed][Ordinal]; } } }
public void Encrypt(Client client) { var length = Data.Length - 3; var rand = new Random(); //var bRand = (ushort)(rand.Next() % 65277 + 256); var bRand = (ushort)(rand.Next(65277) + 256); //var sRand = (byte)(rand.Next() % 155 + 100); var sRand = (byte)(rand.Next(155) + 100); byte[] key; switch (this.EncryptMethod) { case EncryptMethod.Normal: key = client.EncryptionKey; break; case EncryptMethod.MD5Key: key = client.GenerateKey(bRand, sRand); break; default: return; } //var key = (UseDefaultKey) ? client.EncryptionKey : client.GenerateKey(bRand, sRand); for (var i = 0; i < length; i++) { Data[i] ^= key[i % key.Length]; Data[i] ^= SaltTable[client.EncryptionSeed][(i / key.Length) % SaltTable[client.EncryptionSeed].Length]; if ((i / key.Length) % SaltTable[client.EncryptionSeed].Length != Ordinal) { Data[i] ^= SaltTable[client.EncryptionSeed][Ordinal]; } } Data[length] = (byte)(bRand % 256 ^ 0x74); Data[length + 1] = (byte)(sRand ^ 0x24); Data[length + 2] = (byte)((bRand >> 8) % 256 ^ 0x64); }
public void Encrypt(Client client) { var length = Data.Length - 3; var rand = new Random(); var bRand = (ushort)(rand.Next() % 65277 + 256); var sRand = (byte)(rand.Next() % 155 + 100); var key = (UseDefaultKey) ? client.EncryptionKey : client.GenerateKey(bRand, sRand); for (var i = 0; i < length; i++) { Data[i] ^= key[i % key.Length]; Data[i] ^= SaltTable[client.EncryptionSeed][(i / key.Length) % SaltTable[client.EncryptionSeed].Length]; if ((i / key.Length) % SaltTable[client.EncryptionSeed].Length != Ordinal) { Data[i] ^= SaltTable[client.EncryptionSeed][Ordinal]; } } Data[length] = (byte)(bRand % 256 ^ 0x74); Data[length + 1] = (byte)(sRand ^ 0x24); Data[length + 2] = (byte)((bRand >> 8) % 256 ^ 0x64); }
public void Encrypt(Client client) { var length = Data.Length - 3; var rand = new Random(); var bRand = (ushort)(rand.Next() % 65277 + 256); var sRand = (byte)(rand.Next() % 155 + 100); var key = (UseDefaultKey) ? client.EncryptionKey : client.GenerateKey(bRand, sRand); for (var i = 0; i < length; i++) { Data[i] ^= key[i % key.Length]; Data[i] ^= SaltTable[client.EncryptionSeed][(i / key.Length) % SaltTable[client.EncryptionSeed].Length]; if ((i / key.Length) % SaltTable[client.EncryptionSeed].Length != Ordinal) { Data[i] ^= SaltTable[client.EncryptionSeed][Ordinal]; } } Data[length] = (byte)(bRand % 256 ^ 0x74); Data[length + 1] = (byte)(sRand ^ 0x24); Data[length + 2] = (byte)((bRand >> 8) % 256 ^ 0x64); }
public void Decrypt(Client client) { var length = Data.Length - 3; var bRand = (ushort)((Data[length + 2] << 8 | Data[length]) ^ 0x7470); var sRand = (byte)(Data[length + 1] ^ 0x23); var key = (UseDefaultKey) ? client.EncryptionKey : client.GenerateKey(bRand, sRand); for (var i = 0; i < length; i++) { Data[i] ^= key[i % key.Length]; Data[i] ^= SaltTable[client.EncryptionSeed][(i / key.Length) % SaltTable[client.EncryptionSeed].Length]; if ((i / key.Length) % SaltTable[client.EncryptionSeed].Length != Ordinal) { Data[i] ^= SaltTable[client.EncryptionSeed][Ordinal]; } } }