Files
podnoms/server/Utils/Crypt/HMACGenerator.cs
Fergal Moran 0d5778bf90 LE
2018-03-13 21:51:08 +00:00

20 lines
518 B
C#

using System.Security.Cryptography;
using System.Text;
namespace PodNoms.Api.Utils.Crypt
{
public class HMACGenerator
{
public static byte[] CalculateHMACSHA256(string key, string input)
{
return CalculateHMACSHA256(Encoding.ASCII.GetBytes(key), Encoding.ASCII.GetBytes(input));
}
public static byte[] CalculateHMACSHA256(byte[] key, byte[] input)
{
var hash = new HMACSHA256(key);
return hash.ComputeHash(input);
}
}
}