Better random number gen and fix for travis
This commit is contained in:
parent
e3d634a8a3
commit
8b5fb99b0b
2 changed files with 14 additions and 1 deletions
|
@ -6,6 +6,10 @@ php:
|
|||
- '7.0'
|
||||
- hhvm
|
||||
- nightly
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
services:
|
||||
- mysql
|
||||
before_install:
|
||||
|
|
|
@ -226,7 +226,16 @@ class Auth
|
|||
*/
|
||||
public static function generatePasswordHash($password)
|
||||
{
|
||||
$salt = base64_encode(rand(1, 1000000) + microtime());
|
||||
if(function_exists('mt_rand')){
|
||||
mt_srand(time());
|
||||
$num = mt_rand(1, 100000);
|
||||
}
|
||||
else{
|
||||
srand(time());
|
||||
$num = rand(1, 100000);
|
||||
}
|
||||
|
||||
$salt = base64_encode($num);
|
||||
$schemaPrefix = static::getPasswordSchemaPrefix();
|
||||
|
||||
$hash = crypt($password, $schemaPrefix.$salt.'$');
|
||||
|
|
Loading…
Add table
Reference in a new issue