I created a script outside of Joomla that can successfully generate a Joomla password:
// I copied the JUserHelper class from Joomla here
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$psw = $crypt.':'.$salt;
My question is, how can I compare this new crypt:salt I generate above to a password of an existing user in the Joomla database, and know if the password supplied to the script above is the correct password for that user in the database?
This is how Joomla 2.5 Validates a password
See the plugin file : \plugins\authentication\joomla\joomla.php
EDIT: I posted this before the previous reply showed.
You could always break apart the stored password from the salt as they're just separated by a ':' ?
If the page is outside of the Joomla framework you will need to include the framework which should be able to be accomplished with this (reference - codeblock below). If you are inside of the Joomla framework, skip past this block. However, I didn't test the referenced codeblock:
In the framework you will need to look up the user by ID or username:
Then if you have a match for $user you can simply do this access that user's password:
Then you can just compare with what your $psw
I believe that should help you on your way.
Are you looking to use this to log a user in with Joomla credentials to an external site or are you looking to log them in to a Joomla site?
In joomla 3.4.5:
I am sorry to say that the above solution suggested is the worst
One way would be to query the Joomla database directly to get a user's (salted and hashed) password, then compare. I think the below query should work for that, based on what I have seen from a few google searches. I have done this in Wordpress, so I'm assuming Joomla would be similar.