MD5 加密的两种方法

System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
            Random ra = new Random();
            var rr= ra.Next(1,100000);
            byte[] test = System.Text.Encoding.UTF8.GetBytes(rr.ToString());
            Console.WriteLine(rr);
            byte[] output = md5.ComputeHash(test);

            Console.WriteLine("md5-1:" + BitConverter.ToString(output).Replace("-",""));
            Console.WriteLine("md5-2:" + FormsAuthentication.HashPasswordForStoringInConfigFile(rr.ToString(), "MD5"));

 

原文链接:http://www.cnblogs.com/william-lin/p/4663488.html

posted @ 2017-08-17 10:27  有梦想的聪草  阅读(322)  评论(0编辑  收藏  举报