mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
22 lines
510 B
C#
22 lines
510 B
C#
using System;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace NzbDrone.Common.Crypto
|
|
{
|
|
public static class HashConverter
|
|
{
|
|
private static readonly SHA1 Sha1 = SHA1.Create();
|
|
|
|
public static int GetHashInt31(string target)
|
|
{
|
|
byte[] hash;
|
|
lock (Sha1)
|
|
{
|
|
hash = Sha1.ComputeHash(Encoding.Default.GetBytes(target));
|
|
}
|
|
return BitConverter.ToInt32(hash, 0) & 0x7fffffff;
|
|
}
|
|
}
|
|
}
|