refactor: added additional hash check on ingestion

This commit is contained in:
Michael Green
2023-02-28 22:45:14 +11:00
parent 4f19c9b8a3
commit a6003372f5
2 changed files with 207 additions and 151 deletions

View File

@@ -1,4 +1,6 @@
using System;
using System.Security.Cryptography;
namespace gaseous_tools
{
public class Common
@@ -19,6 +21,43 @@ namespace gaseous_tools
return ObjectToCheck;
}
}
public class hashObject
{
public hashObject(string FileName)
{
var xmlStream = File.OpenRead(FileName);
var md5 = MD5.Create();
byte[] md5HashByte = md5.ComputeHash(xmlStream);
string md5Hash = BitConverter.ToString(md5HashByte).Replace("-", "").ToLowerInvariant();
_md5hash = md5hash;
var sha1 = SHA1.Create();
byte[] sha1HashByte = sha1.ComputeHash(xmlStream);
string sha1Hash = BitConverter.ToString(sha1HashByte).Replace("-", "").ToLowerInvariant();
_sha1hash = sha1hash;
}
string _md5hash = "";
string _sha1hash = "";
public string md5hash
{
get
{
return _md5hash;
}
}
public string sha1hash
{
get
{
return _sha1hash;
}
}
}
}
}