// 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 Program { public static string SHA1(String s) { HashAlgorithm alg = new SHA1Managed(); byte[] b = Encoding.ASCII.GetBytes(s); alg.TransformFinalBlock(b, 0, b.Length); return BitConverter.ToString(alg.Hash).Replace("-", ""); } public static void Main(string[] args) { Console.WriteLine(SHA1("The quick brown fox jumps over the lazy dog")); Console.WriteLine(SHA1("")); } } }