mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-19 19:14:51 +00:00
Don't reuse instances of SHA256 when hashing.
This commit is contained in:
parent
573e7c4f1f
commit
541172b001
1 changed files with 1 additions and 4 deletions
|
@ -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("-", "");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue