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.
18 lines
483 B
18 lines
483 B
using System;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace TestServer
|
|
{
|
|
public static class ObjectExtensions
|
|
{
|
|
public static string Md5(this string file)
|
|
{
|
|
using var md5 = MD5.Create();
|
|
using var stream = File.OpenRead(file);
|
|
var hash = md5.ComputeHash(stream);
|
|
stream.Dispose();
|
|
return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
|
}
|
|
}
|
|
} |