Sonarr/src/NzbDrone.Core/Security.cs

27 lines
641 B
C#
Raw Normal View History

2014-04-30 23:39:54 +00:00
using System.Security.Cryptography;
using System.Text;
namespace NzbDrone.Core
{
public static class Security
{
public static string SHA256Hash(this string input)
{
var stringBuilder = new StringBuilder();
using (var hash = SHA256Managed.Create())
{
var enc = Encoding.UTF8;
var result = hash.ComputeHash(enc.GetBytes(input));
foreach (var b in result)
{
stringBuilder.Append(b.ToString("x2"));
}
}
return stringBuilder.ToString();
}
}
}