Recently I have started implementing a solution which will use a PhPbb database for forms authorization, I have used the class from this below thread:
So i wrote a membership provider using this class in the 'ValidateUser' function:
public override bool ValidateUser(string username, string password)
{
ForumsDataContext db = Root.ForumsDataContext;
PhPbbCryptoServiceProvider phpbbCrypt = new PhPbbCryptoServiceProvider();
string remoteHash = db.Users.Where(u => u.UserName == username).FirstOrDefault().UserPassword;
if (String.IsNullOrEmpty(remoteHash))
return false;
return phpbbCrypt.phpbbCheckHash(password, remoteHash);
}
However this always returns false as the 'phpbbCrypt.phpbbCheckHash' returns false and I do not know enough about PhPbb to determine why the hashes are not matching up.
Any sugestions?
If you upgraded your phpbb install from 2.0 the password hashing function is different. I took this snippet from functions.php in phpbb (See: GitHub) this is the entire password checking and hashing functions with a little bit at the end to output a phpbb hashed password.
Important part here is that it isn't a straight MD5. I took the C# class from the link the OP provided and made this test class.
This is a modified copy of the class in the OP question. This will check older passwords which were just an MD5 hash of the plaintext password without a salt and i also added in the prefix "$P$" to be allowed.