Add option to create a secure salt including special chars

This commit is contained in:
Kijin Sung 2015-03-06 15:03:55 +09:00
parent b7a07b0374
commit 8da6ddcfe8

View file

@ -275,6 +275,15 @@ class Password
{
return substr(bin2hex($output), 0, $length);
}
elseif($format === 'printable')
{
$salt = '';
for($i = 0; $i < $length; $i++)
{
$salt .= chr(33 + (crc32(sha1($i . $output)) % 94));
}
return $salt;
}
else
{
$salt = substr(base64_encode($output), 0, $length);