Hi all,
I am using Md5 with Salting for creating user. It's working fine. Below is my code
protected string GenerateSalt()
{
byte[] data = new byte[0x10];
new RNGCryptoServiceProvider().GetBytes(data);
return Convert.ToBase64String(data);
}
private string HashPassword(string password, string salt)
{
// Create an MD5 hash of the supplied password using the supplied salt as well.
string sourceText = salt + password;
ASCIIEncoding asciiEnc = new ASCIIEncoding();
string hash = null;
byte[] byteSourceText = asciiEnc.GetBytes(sourceText);
MD5CryptoServiceProvider md5Hash = new MD5CryptoServiceProvider();
byte[] byteHash = md5Hash.ComputeHash(byteSourceText);
foreach (byte b in byteHash)
{
hash += b.ToString("x2");
}
// Return t ...
Go to the complete details ...