Sunday, April 27, 2008

salting in Password encryption using C#

Salting means :: creating random string and attach with original password before encrypting.So your password are safe and untraceble to dictionary attack.

public string MuruEncrypt(string paramPass)

MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
string salt = Guid.NewGuid().ToString();

byte[] p = UnicodeEncoding.UTF8.GetBytes(text+salt);
byte[] en = md5.ComputeHash(p);
return Convert.ToBase64String(en);