public static void Main()
Console.WriteLine(HashString("test","12345678"));
public static string HashString(string StringToHash, string HashKey)
System.Text.UTF8Encoding myEncoder = new System.Text.UTF8Encoding();
byte[] Key = myEncoder.GetBytes(HashKey);
byte[] Text = myEncoder.GetBytes(StringToHash);
System.Security.Cryptography.HMACSHA256 mySHA = new System.Security.Cryptography.HMACSHA256(Key);
byte[] HashCode = mySHA.ComputeHash(Text);
string hashHex = BitConverter.ToString(HashCode).Replace("-", "");
string hashBase64 = Convert.ToBase64String(HashCode);
return String.Concat(hashHex.ToLower(),"|",hashBase64);