Created
May 12, 2020 15:54
-
-
Save litan1106/8aadccbce2ad0c434328d6fe4e6d2d6c to your computer and use it in GitHub Desktop.
idsrv4-sha256-secret.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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