mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 15:27:21 +01:00
actually start to bring structure into the project
make it resilent against restarts/reloads remove all user interaction for resource gathering compute hashes on first time file resolving and on updates of said file on resolving
This commit is contained in:
parent
c0de781421
commit
da2b2701e8
12 changed files with 379 additions and 232 deletions
22
MareSynchronos/Utils/Crypto.cs
Normal file
22
MareSynchronos/Utils/Crypto.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace MareSynchronos.Utils
|
||||
{
|
||||
public class Crypto
|
||||
{
|
||||
public static string GetFileHash(string filePath)
|
||||
{
|
||||
using SHA1CryptoServiceProvider cryptoProvider = new();
|
||||
return BitConverter.ToString(cryptoProvider.ComputeHash(File.ReadAllBytes(filePath))).Replace("-", "");
|
||||
}
|
||||
|
||||
public static string GetHash(string stringToHash)
|
||||
{
|
||||
using SHA1CryptoServiceProvider cryptoProvider = new();
|
||||
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(stringToHash))).Replace("-", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue