- substr: documentation ( source)
- password_hash: documentation ( source)
- crypt: documentation ( source)
- function_exists: documentation ( source)
- md5: documentation ( source)
<?php
function pswd($password)
{
$conf = new DataStorage();
/*if($conf->value('app.password.salt') !== false)
$salt = '$2y$'.$conf->value('app.password.salt').'$';
else*/
$salt = '$2y$'.substr(md5('zaqDFGDws123xc456derfPOADv78bg9tyGISh0nmjukiolp'), 0, 22).'$';
if(!function_exists('password_hash'))
return crypt($password, $salt);
else
return password_hash($password, PASSWORD_DEFAULT, ['salt' => $salt, 'cost' => 12]);
}
echo pswd('1q2w3e4r5t');