using System.Security.Cryptography;
public static void Main()
byte[] hash = getSha256("1646:8ede3bef-6f5f-4814-91f3-4451783ac2a0");
string hashString = string.Join("", hash.Select(b => string.Format("{0:x2}", b)));
Console.WriteLine(hashString);
var encoded = HttpServerUtility.UrlTokenEncode(hash);
Console.WriteLine(encoded);
public static byte[] getSha256(string text)
byte[] bytes = Encoding.ASCII.GetBytes(text);
SHA256Managed hashstring = new SHA256Managed();
return hashstring.ComputeHash(bytes);