This commit is contained in:
27
server/util/FileHash.cs
Normal file
27
server/util/FileHash.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System;
|
||||
|
||||
namespace Sockeye.Util
|
||||
{
|
||||
|
||||
|
||||
internal static class FileHash
|
||||
{
|
||||
|
||||
internal static string GetChecksum(string filePath)
|
||||
{
|
||||
using (FileStream stream = File.OpenRead(filePath))
|
||||
{
|
||||
|
||||
//SHA256Managed sha = new SHA256Managed();
|
||||
var sha= SHA256.Create();
|
||||
byte[] checksum = sha.ComputeHash(stream);
|
||||
return BitConverter.ToString(checksum).Replace("-", String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
Reference in New Issue
Block a user