// 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 MainClass { private static readonly Encoding utf8 = new UTF8Encoding(); private static readonly MD5 md5 = new MD5CryptoServiceProvider(); private static string MD5Calc(string s) { byte[] binres = md5.ComputeHash(utf8.GetBytes(s)); StringBuilder res = new StringBuilder(""); for(int i = 0; i < binres.Length; i++) { res.Append(String.Format("{0:x2}", binres[i])); } return res.ToString(); } public static string DoubleMD5(string pw, string salt) { return MD5Calc(MD5Calc(pw) + salt); } public static void Main(string[] args) { Console.WriteLine(DoubleMD5("trunte", "7Rg")); } } }