Authenticate external app to Joomla user database

Hi folks, ifound this in a forum. This is for everyone who's trying to authenticate a user against the joomla db and does not know to compare the password. This is no code but only a way you can do it:

Example:

Username:
passexample

User entered Plain text password:
password12

Lookup username in Joomla database and return password stored in database for the username:
bec20914e6738d0150f4af07c0161297:MhMtmNgZRWQgfznO

Explode into parts:
Password:
bec20914e6738d0150f4af07c0161297

Salt:
MhMtmNgZRWQgfznO

Append salt to password:
password12MhMtmNgZRWQgfznO

Plain text password with salt appended to it and md5 encrypted result:
bec20914e6738d0150f4af07c0161297

Compare result to password part from Joomla password. If same good, user is authenticated against Joomla database, if not bad password, try again.

source: http://forum.joomla.org/viewtopic.php?p=1368032