diff options
| author | Appleman1234 <applemansigloo@gmail.com> | 2017-05-04 10:20:11 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-04 10:20:11 +0900 |
| commit | 7c8f857c3b771be84e9537cca93da4546c9c4102 (patch) | |
| tree | f375d2c1ef1fe73be1132fec5288549dc8b664ce | |
| parent | 32655d6163a7d71503b661ee2b8f454700e75d53 (diff) | |
| parent | f978c1b83e9dcb3cab0a0bc52ad8900fb3ac86d4 (diff) | |
Merge pull request #102 from KiTTYsh/master
Use random_bytes() to generate IV where available (PHP 7.x)
| -rw-r--r-- | inc/mod/auth.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/inc/mod/auth.php b/inc/mod/auth.php index 42f34196..2a264f18 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -70,7 +70,11 @@ function test_password($password, $salt, $test) { function generate_salt() { // 128 bits of entropy - return strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.'); + if (function_exists('random_bytes')) { + return strtr(base64_encode(random_bytes(16)), '+', '.'); + } else { + return strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.'); + } } function login($username, $password) { |
