mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Add option to create a secure salt including special chars
This commit is contained in:
parent
b7a07b0374
commit
8da6ddcfe8
1 changed files with 35 additions and 26 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue