Better random number gen and fix for travis

This commit is contained in:
ohartl 2016-04-21 22:07:53 +02:00
parent e3d634a8a3
commit 8b5fb99b0b
2 changed files with 14 additions and 1 deletions

View file

@ -6,6 +6,10 @@ php:
- '7.0'
- hhvm
- nightly
matrix:
allow_failures:
- php: hhvm
- php: nightly
services:
- mysql
before_install:

View file

@ -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.'$');