using System.Security.Cryptography;
public static void Main()
const string PublicKey = "whpnsHMgiNioDB76MXXw";
const string PrivateKey = "F1ihKTGCrPL4UVvSnMBR";
var msisdn = "201063721848";
var operatorCode = "60201";
var date = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ");
var liveURL="http://lookup.tpay.me/idxml.ashx/getmsisdn?";
var stagingURL ="http://enrichment-staging.tpay.me/idxml.ashx/getmsisdn?";
var redirectUrl = "https://www.google.com";
var message = date + redirectUrl + autoRedirect.ToString().ToLower() + orderId;
var theDigest = CalculateDigest(PublicKey, PrivateKey, message);
jsUrl = url+"date="+date+"&redirectUrl="+redirectUrl+"&autoRedirect="+autoRedirect.ToString().ToLower()+"&orderId="+orderId+"&signature="+ theDigest+"&simulate="+simulate+
"&operatorCode="+operatorCode +"&msisdn="+msisdn;
jsUrl = url+"date="+date+"&redirectUrl="+redirectUrl+"&autoRedirect="+autoRedirect.ToString().ToLower()+"&orderId="+orderId+"&signature="+ theDigest;
Console.WriteLine(jsUrl);
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;