using System; using System.Diagnostics; using System.IO; using System.Security.Cryptography; using System.Text; namespace ndh_stay_alive { public class Program { public static string sTrustedPassword = "+5jeyeCv5uejnwa2dd5L7LvIjM4nDFyhhLY+Nj5Rh3wgZFL8Mi3hltRicAalWPuLRQMk91oag4dfWfnj7nD3JB13grBCyFMf6pJwP8bfBQ5+R2kbpJn0tqCMmUNZzFwQFMU+EW0/Nkoup5Zl4hxoPFRfmk1fhKJhfBkdhNYiDqt23jbRoxDbO3QHpy6M2kY/8hd3Z1ds8a1StSQkXxNyjZd2mTQPpTR4zmyf9FzK4Y4XUfzw1hUP3qj+dGyKgNjQmXdtPTOqRVh2T41NSvmK/YV6XzIk6SFdhF9XyXUJOlcII5mXQ/SuHiHmkEoTJiUF3XGN/LkjnNy6pRzZH6s2YC27g7sqqFj71xPY+S3KHLy1y/PwJtz1E7EBzqaXxTxDOE9wiPArIoY9Rl//8RalprwBKeEzZajgbqFz5sEkV6hplGCkiua1FfPXht9Ef8br"; public static void Main(string[] args) { login(Console.ReadLine()); } public static void login(string sPassword) { string sCrypted = null; if (sPassword.Length > 0) { sCrypted = cryptPassword(sPassword); if (sCrypted == sTrustedPassword) { Console.WriteLine("Done!"); } Console.WriteLine("Failed!"); } } public static 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; } public static string base64Encode(string data) { byte[] inArray = Encoding.UTF8.GetBytes(data); return Convert.ToBase64String(inArray); } public static 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()); } } }