I think you need to store both of user name and password after creating the password. but :
If the security is not very important (!) you can generate password without storing it in database.
for example:
public string GeneratePassword(string userName)
{
if (string.IsNullOrEmpty(userName))
return "NAN";
userName = userName.ToUpper();
return string.Format("{0}{1}{2}{3}", "8080110001",EncryptedUserName(userName), userName, DateTime.Now);
}
public int EncryptedUserName(string userName)
{
int partOfSecurity = 0;
foreach (char c in userName)
{
partOfSecurity += (int)c;
}
return partOfSecurity;
}
public bool IsAuthenticated(string userName, string passWord)
{
if (string.IsNullOrEmpty(userName) || passWord.Length <10)
return false;
userName = userName.ToUpper();
return
(passWord.Substring(0, 10) == "8080110001" && passWord.Replace(EncryptedUserName(userName).ToString(), string.Empty) != passWord && passWord.Replace(userName, string.Empty) != passWord)
? true : false;
}
But, I emphasize that it's a poor security.