public bool HashPassword()
{
bool result = true;
string _password_hash = string.Empty;
try
{
if (!string.IsNullOrEmpty(_password_salt) && _password_salt.Contains("!PASSWORD!"))
{
System.Security.Cryptography.SHA1 hash = System.Security.Cryptography.SHA1.Create();
string str = _password_salt.Replace("!PASSWORD!", _password);
_password_hash = BitConverter.ToString(hash.ComputeHash(Encoding.ASCII.GetBytes(str))).Replace("-", "").ToLower();
}
else
result = false;
}
catch
{
result = false;
}
//We have password hash now, replace password field with the hash.
if (result)
{
Password = _password_hash;
}
return result;
}