static void Main(string[] args) { //ServerSimulation.EncryptFile("user.json", "encrypted.txt"); ServerSimulation server = new ServerSimulation(); //Console.WriteLine(server.hashToCompare); Console.WriteLine("Enter Password Please"); string checkString = Console.ReadLine(); bool check = Check(checkString, server); if (check) { DecryptFile("encrypted.txt", "user.json"); } else { Console.WriteLine("It is not your program"); Console.ReadLine(); Environment.Exit(-1); } //Task task = SavetoJson(); //task.Wait(); //Task task2 = ReadFromJson(); //task2.Wait(); System.Menu(); //string readText = File.ReadAllText(@"user.json"); //File.WriteAllText(@"user.json", File.ReadAllText(@"user.json")); //Console.WriteLine(readText); Console.ReadKey(); }
public static bool Check(string password, ServerSimulation s) { password += s.addString; string hash = GetHashString(password); if (hash.SequenceEqual(s.hashToCompare)) { return(true); } else { return(false); } }