Created
September 12, 2013 15:46
-
-
Save huanlin/6539743 to your computer and use it in GitHub Desktop.
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile() is obsoleted, use MD5 class instead.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string MD5Hash(string str) | |
{ | |
// return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pwd); | |
var md5 = MD5.Create(); | |
var hashedBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); | |
var hashedStr = String.Join("", hashedBytes.Select(x => x.ToString("x2"))); | |
return hashedStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment