forked from leftypol/leftypol
Merge branch 'master' of https://github.com/lainchan/lainchan
This commit is contained in:
commit
bd9d2bd44f
1 changed files with 5 additions and 1 deletions
|
@ -70,7 +70,11 @@ function test_password($password, $salt, $test) {
|
||||||
|
|
||||||
function generate_salt() {
|
function generate_salt() {
|
||||||
// 128 bits of entropy
|
// 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) {
|
function login($username, $password) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue