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.
20 lines
560 B
20 lines
560 B
using System; |
|
using System.IO; |
|
using System.Security.Cryptography; |
|
|
|
namespace Kingo.Plugin.EngineEditor.Common |
|
{ |
|
public class FileHash |
|
{ |
|
public static string GetHash(string path) |
|
{ |
|
//var hash = SHA256.Create(); |
|
//var hash = MD5.Create(); |
|
var hash = SHA1.Create(); |
|
var stream = new FileStream(path, FileMode.Open); |
|
byte[] hashByte = hash.ComputeHash(stream); |
|
stream.Close(); |
|
return BitConverter.ToString(hashByte).Replace("-", ""); |
|
} |
|
} |
|
}
|
|
|