Could you please advise me some easy algorithm for hashing user password by MD5, but with salt for increasing reliability.
Now I have this one:
private static string GenerateHash(string value)
{
var data = System.Text.Encoding.ASCII.GetBytes(value);
data = System.Security.Cryptography.MD5.Create().ComputeHash(data);
return Convert.ToBase64String(data);
}
You can use the HMACMD5 class:
Works with SHA-1, SHA256, SHA384, SHA512 and RIPEMD160 as well:
Both
saltandpasswordare expected as byte arrays.If you have strings you’ll have to convert them to bytes first: