I produced a script outdoors of Joomla that may effectively produce a Joomla password:

// I copied the JUserHelper class from Joomla here
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$psw = $crypt.':'.$salt;

My real question is, how do i match it up new crypt:salt I generate above to some password of the existing user within the Joomla database, and determine if the password provided towards the script above may be the correct password for your user within the database?

EDIT: I published this prior to the previous reply demonstrated.

You can always falter the saved password in the salt as they are just separated with a ':' ?


When the page is outdoors from the Joomla framework you will have to range from the framework that ought to have the ability to be accomplished with this particular (reference - codeblock below). If you're within the Joomla framework, skip past this block. However, I did not test the recommended codeblock:

define( '_JEXEC', 1 );

define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE', dirname(__FILE__).DS."..".DS.".." );

require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

Within the framework you will have to lookup the consumer by ID or username:

$user  =& JFactory::getUser(username or id goes here);

Then for those who have a match for $user you can just do that access that user's password:

$user->password;

You'll be able to just match up against what your $psw


In my opinion that ought to help for your way.

Are you currently searching to make use of this to log a person along with Joomla qualifications for an exterior site or are you currently searching to log them in a Joomla site?

One of the ways is always to query the Joomla database directly to obtain a user's (salted and hashed) password, then compare. I believe the below query should work for your, according to what I've come across from the couple of google searches. I've carried this out in Wordpress, so I am presuming Joomla could be similar.

select 'password' from `jos_users` WHERE `username` = "Bob";