Well, i can give you the code i use for getting the encryption function in the other CMS (Wordpress).
I used this function's in a Wordpress plugin so i can get the login working in Wordpress.
Hope it help you.
<?php
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
/**
* Convert \n to
* @param string $string String to transform
* @return string New string
*/
function nl2br2($string)
{
return str_replace(array("\r\n", "\r", "\n"), '
', $string);
}
/* Sanitize data which will be injected into SQL query
*
* @param string $string SQL data which will be injected into SQL query
* @param boolean $htmlOK Does data contain HTML code ? (optional)
* @return string Sanitized data
*/
function pSQL($string, $htmlOK = false)
{
if (_PS_MAGIC_QUOTES_GPC_)
$string = stripslashes($string);
if (!is_numeric($string))
{
$string = _PS_MYSQL_REAL_ESCAPE_STRING_ ? mysql_real_escape_string($string) : addslashes($string);
if (!$htmlOK)
$string = strip_tags(nl2br2($string));
}
echo "->".$string."
";
return $string;
}
/**
* Encrypt password
*
* @param object $object Object to display
*/
function encrypt($passwd)
{
return md5(pSQL($passwd));
}
/*Ngk2AO1iQSjZDC9MbUpEYmn0Za13swCcJHO7Bek3UL0MrjKZFizE9Rxy -> Defined in /config/settings.inc.php _COOKIE_KEY_ constant*/
echo encrypt("Ngk2AO1iQSjZDC9MbUpEYmn0Za13swCcJHO7Bek3UL0MrjKZFizE9Rxy"."abcdefg");
?>