public static class PasswordHasher
{
private static SHA1Managed hasher = new SHA1Managed();
public static string Hash(string password)
{
byte[] passwordBytes = System.Text.ASCIIEncoding.
byte[] passwordHash = hasher.ComputeHash(passwor
return Convert.ToBase64String(pas
}
Write this to the database field:
string pw = "";
pw = SecurityLib.PasswordHasher
To retrieve the password and check it against the one in the database:
// value from database:
hashedPassword = reader["PW"].ToString();
reader.Close();
if (SecurityLib.PasswordHashe
{
lblLoginMsg.Text = "We're sorry. We did not recognize that e-mail/password combination. <br>Please try again.";
return;
}
else
{
FormsAuthentication.Redire
Main Topics
Browse All Topics





by: mac-willPosted on 2008-11-28 at 12:08:53ID: 23057191
You need to provide more details on what you have already tried, what you want and how secure it needs to be. You can't just ask for a solution when the problem is not very clear.
If you only want a simple encryption you can do something like this:
Select allOpen in new window