using System.Security.Cryptography;
public static void Main()
string token = "secret=secretkey, id=16353, email=florentina.bacioi@fintechos.com, timeStamp=02192020,";
var sha256 = ComputeSha256Hash(token);
var tokenToBeComparedWith = ComputeSha256Hash(token);
Console.WriteLine("Token : " + token);
Console.WriteLine("Final encoded token: " + tokenToBeComparedWith);
static string ComputeSha256Hash(string rawData)
SHA256 sha256 = SHA256.Create();
byte[] bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(rawData));
string generatedToken = Convert.ToBase64String(bytes);
return GetHashSha256(generatedToken).ToUpper();
static public string GetHashSha256(string text)
byte[] bytes = Encoding.ASCII.GetBytes(text);
SHA256Managed hashstring = new SHA256Managed();
byte[] hash = hashstring.ComputeHash(bytes);
string hashString = string.Empty;
hashString += String.Format("{0:x2}", x);