Home  >  Article  >  Backend Development  >  MD5 encryption algorithm used for login accounts in C#

MD5 encryption algorithm used for login accounts in C#

大家讲道理
大家讲道理Original
2016-11-10 14:58:301495browse

public static string GetMD5(string sDataIn)  
       {  
           MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();  
           byte[] bytValue, bytHash;  
           bytValue = System.Text.Encoding.UTF8.GetBytes(sDataIn);  
           bytHash = md5.ComputeHash(bytValue);  
           md5.Clear();  
           string sTemp = "";  
           for (int i = 0; i < bytHash.Length; i++)  
           {  
               sTemp += bytHash[i].ToString("X").PadLeft(2, &#39;0&#39;);  
           }  
           return sTemp.ToLower();  
       }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn