Esempio n. 1
0
        static void Main(string[] args)
        {
            string path = @"C:\Users\T. Jezioro\Documents\Visual Studio 2015\Projects\PasswordEncryption\password.txt";
            string hash;

            string password = Gui.ReadPasswordFromUser();

            MD5 md5Hash = Md5Encryption.Md5Creat();

            hash = Md5Encryption.GetMd5Hash(md5Hash, password);

            if (IoFile.Exist(path) != true)
            {
                IoFile.WriteAll(path, hash);
                Gui.WriteLine("File created. Password saved.");
            }
            else
            {
                bool checkPassword = ComparisonUtil.CheckPassword(hash, path);
                if (checkPassword == true)
                {
                    Gui.WriteFontGreen("Password is correct");
                }
                else
                {
                    Gui.WriteFontRed("Password is NOT correct");
                }
            }
            Gui.GuiSpace();
            Gui.Write("Please press any key to close this application.");
            Console.ReadKey();
        }
Esempio n. 2
0
 public static void GuiSpace()
 {
     Gui.WriteLine("");
 }
Esempio n. 3
0
 public static void WriteFontGreen(string text)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Gui.WriteLine(text);
     Gui.ResetColor();
 }