using System.Security.Cryptography;
public static void Main()
const string PublicKey = "4EujaALPO6hQeljIHquD";
const string PrivateKey = "yDuhlLhBpwiIV40nvGXn";
var MerchantTemplateKey = "TestTemplate";
var operatorCode = "60201";
var productCatalogName = "100Coins";
var RedirectUrl = "www.google.com";
var message = MerchantTemplateKey + msisdn + operatorCode + productCatalogName + productPrice + language + orderInfo + RedirectUrl;
var theDigest = CalculateDigest(PublicKey, PrivateKey, message);
Console.WriteLine(theDigest);
public static string CalculateDigest(string publicKey, string privateKey, string message)
var hash = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(privateKey));
var correctHash = string.Join(string.Empty, hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(message)).Select(b => b.ToString("x2")));
digest = publicKey + ":" + correctHash;