// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text; using System.Security.Cryptography; namespace E { public class Util { public static string SHA256(string pw) { HashAlgorithm alg = new SHA256Managed(); byte[] b = Encoding.UTF8.GetBytes(pw); alg.TransformFinalBlock(b, 0, b.Length); return BitConverter.ToString(alg.Hash).Replace("-", ""); } } public class Program { public static void Main(string[] args) { Console.WriteLine(Util.SHA256("Hemmmeligt")); Console.WriteLine(Util.SHA256("Super hemmmeligt")); } } }