using System.Globalization;
using System.Security.Cryptography;
public static void Main()
var checksum = "550fe80b4c4a41e70fa4320fc2e38298";
var cutHash = checksum.Remove(3, 24);
var pckg = new Package();
Console.WriteLine("Cut hash: {0}", cutHash);
var kioskHash = MD5Hash("59033511" + "37" + "WaselRecharge" + "megasalt" + "50" + "0505050112" + "20161130104220" + "BFEBFBFF000506E37224D038");
Console.WriteLine(kioskHash);
var timestamp = "20170101101010";
var hardwareId = "abcdefghijklmnopqrstuvwzyx";
string md5 = MD5Hash(string.Format("{0}{1}megasalt{2}{3}{4}{5}", pckg.ClientIdentifier, pckg.ProviderId, decimal.ToInt32(pckg.Amount), pckg.Account, timestamp, hardwareId));
public static string MD5Hash(string str)
MD5CryptoServiceProvider x = new MD5CryptoServiceProvider();
byte[] bs = Encoding.UTF8.GetBytes(str.ToUpper());
StringBuilder sb = new StringBuilder();
sb.Append(b.ToString("X2").ToLower());
string sign = sb.ToString();
public string Account="0500100200";
public decimal Amount = 5;
public string ClientIdentifier="12345678";