string password = txtPassword.Text.Trim();byte[] result = Encoding.Default.GetBytes(password);MD5 md5 = new MD5CryptoServiceProvider();byte[] output = md5.ComputeHash(result);password = BitConverter.ToString(output).Replace("-", ""); 原文:http://www.cnblogs.com/hjzbk/p/5060936.html