You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
using System;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace CheckSum
|
|
{
|
|
internal class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
Console.InputEncoding = Encoding.UTF8;
|
|
Console.OutputEncoding = Encoding.UTF8;
|
|
using var sha = SHA512.Create();
|
|
while (true)
|
|
{
|
|
Console.WriteLine("input file name:");
|
|
var file = Console.ReadLine();
|
|
if (File.Exists(file))
|
|
{
|
|
Console.WriteLine(BitConverter.ToString(sha.ComputeHash(File.ReadAllBytes(file))).Replace("-", "").ToLower());
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine($"file {file} does not Exist");
|
|
}
|
|
var key = Console.ReadKey().Key;
|
|
if (key == ConsoleKey.Enter || key == ConsoleKey.Escape)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |