using System.Security.Cryptography;
using System.Text.RegularExpressions;
public static void Main()
string key = "c277b45fa126b8174d07ae7048bf5925";
string message = "210773 la ma xac thuc Tozaco cua ban.";
string phone = "84383101855";
string phoneEdit = FormatPhonenumberStartWith84(phone);
string mac = uid+phoneEdit+message+key;
Console.WriteLine(sha256(mac));
Console.WriteLine(FormatPhonenumberStartWith84(phone));
public static string FormatPhonenumberStartWith84(string PhoneNumber)
if (PhoneNumber.StartsWith("84"))
PhoneNumber = Regex.Replace(PhoneNumber, "^84", "0");
private static string sha256(string randomString)
var crypt = new SHA256Managed();
var hash = new System.Text.StringBuilder();
byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(randomString));
foreach (byte theByte in crypto)
hash.Append(theByte.ToString("x2"));