Skip to content

Instantly share code, notes, and snippets.

@litan1106
Created May 12, 2020 15:54
Show Gist options
  • Save litan1106/8aadccbce2ad0c434328d6fe4e6d2d6c to your computer and use it in GitHub Desktop.
Save litan1106/8aadccbce2ad0c434328d6fe4e6d2d6c to your computer and use it in GitHub Desktop.
idsrv4-sha256-secret.cs
using System;
using System.Text;
using System.Security.Cryptography;
public class Program
{
public static void Main()
{
Console.WriteLine(GetSHA256Hash("secret"));
}
public static string GetSHA256Hash(string input)
{
var sha256 = SHA256.Create();
var bytes = Encoding.ASCII.GetBytes(input);
var hash = sha256.ComputeHash(bytes);
return Convert.ToBase64String(hash);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment