mirror of
https://github.com/Radarr/Radarr
synced 2026-01-24 00:13:43 +01:00
fix: thread-safe SHA1 hashing in HashConverter
This commit is contained in:
parent
1fe49f6bf2
commit
a57775a9ee
1 changed files with 2 additions and 6 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue