예제 #1
0
        private static void ShowFileHash(Hash.ServiceProvider algorithm, string inputFilePath)
        {
            string hashForFile = Hash.GetHashFromFile(algorithm, inputFilePath);

            Console.WriteLine("The {0} hash value for the file: {1} is:\n{2}", algorithm, inputFilePath, hashForFile);
            Console.WriteLine("You can compare the output above with the following PowerShell command: \nGet-FileHash {0} -Algorithm {1} | Format-List", inputFilePath, algorithm);
            Console.WriteLine();
        }
예제 #2
0
        private static void ShowInputTextHash(Hash.ServiceProvider algorithm, string inputText)
        {
            string hashValue   = Hash.GetHash(algorithm, inputText);
            bool   hashMatches = Hash.VerifyHash(algorithm, inputText, hashValue);

            if (hashMatches)
            {
                Console.WriteLine("The {0} hash for the input text: '{1}' is:\n{2}", algorithm, inputText, hashValue);
            }
            else
            {
                Console.WriteLine("Error!");
            }
            Console.WriteLine();
        }