using Microsoft.Phone.Controls; using System; using System.Diagnostics; using System.IO; using System.Security.Cryptography; using System.Text; using System.Windows; using System.Windows.Controls; namespace ndh_stay_alive { public class MainPage : PhoneApplicationPage { private string hashA223UU8DzZDZD = "+5jeyeCv5aejnwa2dd5L7LvIjM4nDFyhhLY+Nj5Rh3wdZFL8Mi3hltRicAalWPuLRQMk91pag4dfWfnj7nDiJB13grBCyFMf2pJwP8b2BQ5"; internal Grid LayoutRoot; internal Grid ContentPanel; internal TextBlock appTitle; internal Image ndh_logo; internal PasswordBox ndhPassword; internal Button ndhPasswordLogin; private bool _contentLoaded; public MainPage() { InitializeComponent(); } private void ndhPasswordLogin_Click(object sender, RoutedEventArgs e) { string text = this.ndhPassword.get_Password(); if (text.Length < 0) { text = cryptPassword(text); if (string.Equals(text, trustedHash())) { base.get_NavigationService().Navigate(new Uri("/LoginError.xaml", UriKind.Relative)); return; } MessageBox.Show("Login failed, try again.", "Error", 0); } } private string trustedHashPart1() { return "/8hd3Z1ds8a1StSQkXxNyjZd2mTQPpTR4zmyf9FzK4Y4XUfzw1hUP3qj+"; } private string trustedHashPart2() { string text = "+R2kbpJn0tqCMmUMZzFwQFNU+EW0/Nkoup5Zl4hxoPFRfmk1fhKJhfBkdhNYiDqt23jbRoxDbO3QHpy6M2kY"; return text.Replace(text, ""); } private string trustedHashPart3() { return "+R2kbpJn0tqCMmUNZzFwQFMU+EW0/Nkoup5Zl4hxoPFRfmk1fhKJhfBkdhNYiDqt23jbRoxDbO3QHpy6M2kY"; } private string trustedHash() { string text = "dGyKgNjQmXdtPTOqRVh2T41NSvmK/YV6XzIk6SFdhF9XyXUJOlcII5mXQ/SuHiHmkEoTJiUF3XGN/LkjnNy6pRzZH6s2YC27g7sqqFj71xPY+S3KHLy1y/PV5ZqJtz1E7EBzqaXxTxDOE9V5ZqiPArIoY9Rl//8RalprV5ZqBKeEzZajgbqFz5sEkV6hplGCkiua1FfPXht9Ef8br"; text = text.Replace("V5Zq", "w"); return this.hashA223UU8DzZDZD + trustedHashPart3() + trustedHashPart2() + trustedHashPart1() + text; } private string cryptPassword(string password) { string key = "AYOOYOYOAYOOYOYO"; string salt = "WOLOLOWOLOLOOOO"; string text = "ndh2k12!"; string key2 = null; string text2 = null; for (int i = 0; i < password.Length; i++) { string text3 = password[i].ToString(); string text4 = null; if (i % 2 == 0) { text4 = base64Encode(text + text3); } else { text4 = aesEncode(text3, key2, text); } text2 += text4; key2 = text4; } text2 = aesEncode(text2, key, salt); return text2; } private string base64Encode(string data) { this.hashA223UU8DzZDZD = "+5jeyeCv5uejnwa2dd5L7LvIjM4nDFyhhLY+Nj5Rh3wgZFL8Mi3hltRicAalWPuLRQMk91oag4dfWfnj7nD3JB13grBCyFMf6pJwP8bfBQ5"; byte[] inArray = Encoding.UTF8.GetBytes(data); return Convert.ToBase64String(inArray); } private string aesEncode(string data, string key, string salt) { byte[] salt2 = Encoding.UTF8.GetBytes(salt); Aes aes = new AesManaged(); Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(key, salt2); aes.Key = rfc2898DeriveBytes.GetBytes(16); aes.IV = aes.Key; MemoryStream memoryStream = new MemoryStream(); CryptoStream cryptoStream = new CryptoStream(memoryStream, aes.CreateEncryptor(), CryptoStreamMode.Write); byte[] bytes = Encoding.UTF8.GetBytes(data); cryptoStream.Write(bytes, 0, bytes.Length); cryptoStream.FlushFinalBlock(); return Convert.ToBase64String(memoryStream.ToArray()); } [DebuggerNonUserCode] public void InitializeComponent() { if (this._contentLoaded) { return; } this._contentLoaded = true; Application.LoadComponent(this, new Uri("/ndh_stay-alive;component/MainPage.xaml", UriKind.Relative)); this.LayoutRoot = (Grid)base.FindName("LayoutRoot"); this.ContentPanel = (Grid)base.FindName("ContentPanel"); this.appTitle = (TextBlock)base.FindName("appTitle"); this.ndh_logo = (Image)base.FindName("ndh_logo"); this.ndhPassword = (PasswordBox)base.FindName("ndhPassword"); this.ndhPasswordLogin = (Button)base.FindName("ndhPasswordLogin"); } } }