28 lines
738 B
C#
28 lines
738 B
C#
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace SaveWizard_rewritten
|
|
{
|
|
static class Utils
|
|
{
|
|
public static string GenerateMD5(string filename)
|
|
{
|
|
if (!File.Exists(filename))
|
|
return null;
|
|
using (var md5 = MD5.Create())
|
|
{
|
|
using (FileStream stream = File.OpenRead(filename))
|
|
md5.ComputeHash(stream);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
byte[] hash = md5.Hash;
|
|
for (int i = 0; i < hash.Length; i++)
|
|
sb.Append(hash[i].ToString("x2"));
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|