mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-18 16:41:36 -07:00
* add background updating * add RobloxState * fix potential race condition with RobloxState * update ForceRobloxReinstallation in menu * disable AssertReadOnlyDirectory * add storage space check * add logging to IsEligibleForBackgroundUpdate * add a setting to toggle background updates * fix mutex names being mixed up * update string * update strings * update strings
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Security.Cryptography;
|
|
|
|
namespace Bloxstrap.Utility
|
|
{
|
|
public static class MD5Hash
|
|
{
|
|
public static string FromBytes(byte[] data)
|
|
{
|
|
using MD5 md5 = MD5.Create();
|
|
return Stringify(md5.ComputeHash(data));
|
|
}
|
|
|
|
public static string FromStream(Stream stream)
|
|
{
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
using MD5 md5 = MD5.Create();
|
|
return Stringify(md5.ComputeHash(stream));
|
|
}
|
|
|
|
public static string FromFile(string filename)
|
|
{
|
|
using MD5 md5 = MD5.Create();
|
|
using FileStream stream = File.OpenRead(filename);
|
|
return FromStream(stream);
|
|
}
|
|
|
|
public static string FromString(string str)
|
|
{
|
|
return FromBytes(Encoding.UTF8.GetBytes(str));
|
|
}
|
|
|
|
public static string Stringify(byte[] hash)
|
|
{
|
|
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
|
}
|
|
}
|
|
}
|