using System.Security.Cryptography;
public static void Main()
var publicKey = "EF48pcOY0Gt7q1ZlOyFB";
var privateKey = "kfqA2yCeE4bpiH83uFcU";
var msisdn = "201220805413";
var IMEI = "990000862471854";
var message = msisdn + pinCode + IMEI;
var theDigest = CalculateDigest(publicKey, privateKey, message);
Console.WriteLine("{\n\"signature\": \"" + theDigest+ "\",\n"+
"\"msisdn\": \"" + msisdn+ "\",\n" +
"\"pinCode\": \"" + pinCode+ "\",\n" +
"\"IMEI\": \"" + IMEI+ "\"\n}"
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;