Tutorials to .com

Tutorials to .com » Dotnet » Foundation » ASP_NET using MD5 encryption

ASP_NET using MD5 encryption

Print View , by: iSee ,Total views: 11 ,Word Count: 136 ,Date: Wed, 26 Aug 2009 Time: 4:00 PM

In fact,. Net there is a simple way to achieve the MD5
<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 [i]);
)
return str2;
)

Link Address: http://dygstudio.cnblogs.com/archive/2006/07/13/449988.html


.NET foundation Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.