24 lines
609 B
C#
24 lines
609 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Server.Algorithm
|
|
{
|
|
public static class GetHash
|
|
{
|
|
public static string GetChecksum(string file)
|
|
{
|
|
using (FileStream stream = File.OpenRead(file))
|
|
{
|
|
SHA256Managed sha = new SHA256Managed();
|
|
byte[] checksum = sha.ComputeHash(stream);
|
|
return BitConverter.ToString(checksum).Replace("-", String.Empty);
|
|
}
|
|
}
|
|
}
|
|
}
|