fix: thread-safe SHA1 hashing in HashConverter

This commit is contained in:
admin 2025-12-19 10:29:44 -06:00
parent 1fe49f6bf2
commit a57775a9ee

View file

@ -6,8 +6,6 @@ namespace NzbDrone.Common.Crypto
{
public static class HashConverter
{
private static readonly SHA1 Sha1 = SHA1.Create();
public static int GetHashInt31(string target)
{
var hash = GetHash(target);
@ -16,10 +14,8 @@ public static int GetHashInt31(string target)
public static byte[] GetHash(string target)
{
lock (Sha1)
{
return Sha1.ComputeHash(Encoding.Default.GetBytes(target));
}
using var sha1 = SHA1.Create();
return sha1.ComputeHash(Encoding.Default.GetBytes(target));
}
}
}