MD5 Method:
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, ' 0 ');
}
return Stemp.tolower ();
}
Password Plus salt
public static string Getpasswordsalt ()
{
String getpasswordsalt= configurationmanager.appsettings["PasswordSalt"];
return getpasswordsalt;
}
PasswordSalt is called salt, and its contents are stored in the App. Config file, and the code in the app:
<configuration>
<appSettings>
<add key= "PasswordSalt" value= "1234"/>//1234 for salt, denoted by parameter PasswordSalt
</appSettings>
</configuration>
. NET down-MD5 algorithm and salt addition