This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15551|Reply: 0

[ASP.NET] ASP.NET uses MD5 encryption

[Copy link]
Posted on 6/10/2015 8:19:34 PM | | |

The encrypted ciphertext is 32 bits, and I counted them one by one.
In fact, there is an easiest way to implement MD5 in .net
        <summary>
        MD5 encryption
        /// </summary>
        <param name="toCryString"> encrypted string</param>
        <returns>Encrypted string</returns>
        public static string MD5(string toCryString)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(toCryString, "MD5");
        }


Method 2:
public static string MD5(string str)
  {
   MD5 md5 = new MD5CryptoServiceProvider();
   byte[] result = md5. ComputeHash(System.Text.Encoding.Default.GetBytes(str));
   string str2 = "";
   for(int i=0; i<result. Length; i++)
   {
    str2 += string. Format("{0:x}",result);
   }
   return str2;
  }




Previous:list collection deduplicates data
Next:asp.net modify the LINQ app.config configuration file to web.config
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com