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.
37 lines
1.0 KiB
37 lines
1.0 KiB
using System;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
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;
|
|
var file = string.Empty;
|
|
using var sha = SHA1.Create();
|
|
if (args.Length > 0)
|
|
{
|
|
file = args[0];
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("input file name:");
|
|
file = Console.ReadLine();
|
|
}
|
|
if (File.Exists(file))
|
|
{
|
|
Console.WriteLine(BitConverter.ToString(sha.ComputeHash(File.ReadAllBytes(file))).Replace("-", ""));
|
|
ZipFile.ExtractToDirectory(file, Path.Combine(Directory.GetCurrentDirectory(), "IoTNode"), true);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine($"file {file} does not Exist");
|
|
}
|
|
}
|
|
}
|
|
} |