Don't reuse instances of SHA256 when hashing.

This commit is contained in:
Slendy 2024-06-25 04:38:21 -05:00
parent 573e7c4f1f
commit 541172b001
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -9,9 +9,6 @@ namespace LBPUnion.ProjectLighthouse.Helpers;
public static class CryptoHelper
{
private static readonly SHA256 sha256 = SHA256.Create();
/// <summary>
/// Generates a random SHA256 and BCrypted token
/// </summary>
@ -156,7 +153,7 @@ public static class CryptoHelper
public static string Sha256Hash(string str) => Sha256Hash(Encoding.UTF8.GetBytes(str));
public static string Sha256Hash(byte[] bytes) => BitConverter.ToString(sha256.ComputeHash(bytes)).Replace("-", "").ToLower();
public static string Sha256Hash(byte[] bytes) => BitConverter.ToString(SHA256.HashData(bytes)).Replace("-", "").ToLower();
public static string Sha1Hash(byte[] bytes) => BitConverter.ToString(SHA1.HashData(bytes)).Replace("-", "");