private byte[] ProcessChallenge(byte[] cha, WaveApplication app, bool createAccount) { byte[] user = null; byte[] password = null; byte[] passwordHash = null; byte[] encCha = (byte[])cha.Clone(); if (app.HasLogin) { user = StringHelper.GetBytes(app.Login); password = (byte[])app.Password.Clone(); } else { user = new byte[0]; password = new byte[4]; } // determine if the password should be hashed if (!createAccount && app.HasLogin && app.Login.StartsWith(GeneratedUsernamePrefix)) { // no hashing in here passwordHash = (byte[])password.Clone(); } else { // hash it using (SHA1Managed hasher = new SHA1Managed()) { passwordHash = hasher.ComputeHash(password); } } // encrypt the challenge sessionHandshakeFish = new Blowfish(passwordHash); sessionHandshakeFish.Encrypt(encCha, encCha.Length); // assembling result byte[] res = new byte[1 + user.Length + encCha.Length]; res[0] = (byte)user.Length; for (int i = 0; i < user.Length; i++) { res[i + 1] = (byte)(user[i] ^ (i + 0xD1)); // simple XOR encryption } Array.Copy(encCha, 0, res, 1 + user.Length, encCha.Length); return(res); }
public static void Start(WaveApplication appInfo) { // saving application info Application = appInfo; // saving data from global App object BuildID = App.Instance.Build.BuildID; UseEncryption = !App.Instance.Build.PlatformOptions.Contains(PlatformOption.NoEncryption); IsMetro = App.Instance.Build.ClientOptions[ClientOption.MetroOptimisations].Equals(WaveConstant.True, StringComparison.InvariantCultureIgnoreCase); // initialising agents Settings.Start(); Cache.Start(); Network.Start(); }
protected override void OnElementChanged(ElementChangedEventArgs <WaveEngineSurface> e) { base.OnElementChanged(e); if (Control == null) { _gameView = new Canvas(); _swapChainPanel = new SwapChainPanel(); _gameView.Children.Add(_swapChainPanel); Canvas.SetTop(_swapChainPanel, 0); Canvas.SetLeft(_swapChainPanel, 0); _gameContext = new WaveApplication(_swapChainPanel); SetNativeControl(_gameView); Element.InputTransparent = false; Element.InputTransparent = false; Element.SizeChanged += Element_SizeChanged; } }
public void LoadApplication(WaveApplication app) { HideOverlay(); ThreadHelper.Sync(() => Core.Start(app)); }