public void Init() { TmpKey1 = Utils.ShiftKey(ServerKey1, 31); TmpKey2 = Utils.XorKey(TmpKey1, ClientKey1); TmpKey1 = Utils.ShiftKey(ClientKey2, 17, false); DecryptKey = Utils.XorKey(TmpKey1, TmpKey2); Decryptor = new Cryptor(DecryptKey); TmpKey1 = Utils.ShiftKey(ServerKey2, 79); Decryptor.ApplyCryptor(TmpKey1, 128); EncryptKey = new byte[128]; Buffer.BlockCopy(TmpKey1, 0, EncryptKey, 0, 128); Encryptor = new Cryptor(EncryptKey); }
public void Init(string region) { if (region == "KR") { TmpKey1 = Utils.ShiftKey(ServerKey1, 67); } else { TmpKey1 = Utils.ShiftKey(ServerKey1, 31); } TmpKey2 = Utils.XorKey(TmpKey1, ClientKey1); if (region == "KR") { TmpKey1 = Utils.ShiftKey(ClientKey2, 29, false); } else { TmpKey1 = Utils.ShiftKey(ClientKey2, 17, false); } DecryptKey = Utils.XorKey(TmpKey1, TmpKey2); Decryptor = new Cryptor(DecryptKey); if (region == "KR") { TmpKey1 = Utils.ShiftKey(ServerKey2, 41); } else { TmpKey1 = Utils.ShiftKey(ServerKey2, 79); } Decryptor.ApplyCryptor(TmpKey1, 128); EncryptKey = new byte[128]; Buffer.BlockCopy(TmpKey1, 0, EncryptKey, 0, 128); Encryptor = new Cryptor(EncryptKey); }
public void Init(string region) { //if (region == "KR" || region == "JP" || region == "RU" || region == "EU" || region == "NA") //{ TmpKey1 = Utils.ShiftKey(ServerKey1, 67); //} //else //{ // TmpKey1 = Utils.ShiftKey(ServerKey1, 31); //} TmpKey2 = Utils.XorKey(TmpKey1, ClientKey1); //if (region == "KR" || region == "JP" || region == "RU" || region == "EU" || region == "NA") //{ TmpKey1 = Utils.ShiftKey(ClientKey2, 29, false); //} //else //{ // TmpKey1 = Utils.ShiftKey(ClientKey2, 17, false); //} DecryptKey = Utils.XorKey(TmpKey1, TmpKey2); Decryptor = new Cryptor(DecryptKey); //if(region == "KR" || region == "JP" || region == "RU" || region == "EU" || region == "NA") //{ TmpKey1 = Utils.ShiftKey(ServerKey2, 41); //} //else //{ // TmpKey1 = Utils.ShiftKey(ServerKey2, 79); //} Decryptor.ApplyCryptor(TmpKey1, 128); EncryptKey = new byte[128]; Buffer.BlockCopy(TmpKey1, 0, EncryptKey, 0, 128); Encryptor = new Cryptor(EncryptKey); }
public Session(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, byte[] serverKey2, bool newshifts = true) { ClientKey1 = clientKey1; ClientKey2 = clientKey2; ServerKey1 = serverKey1; ServerKey2 = serverKey2; TmpKey1 = Utils.ShiftKey(ServerKey1, newshifts ? 67 : 31); TmpKey2 = Utils.XorKey(TmpKey1, ClientKey1); TmpKey1 = Utils.ShiftKey(ClientKey2, newshifts ? 29 : 17, false); DecryptKey = Utils.XorKey(TmpKey1, TmpKey2); Decryptor = new Cryptor(DecryptKey); TmpKey1 = Utils.ShiftKey(ServerKey2, newshifts ? 41 : 79); Decryptor.ApplyCryptor(TmpKey1, 128); EncryptKey = new byte[128]; Buffer.BlockCopy(TmpKey1, 0, EncryptKey, 0, 128); Encryptor = new Cryptor(EncryptKey); }
public void Decrypt(byte[] data) { Decryptor.ApplyCryptor(data, data.Length); }