Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
AJXP_Utils: Make sure to remove = from base64encoded string when gene…
Browse files Browse the repository at this point in the history
…rating random string.
  • Loading branch information
cdujeu committed Apr 7, 2015
1 parent aafd5fa commit 545910c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -1945,7 +1945,7 @@ public static function generateRandomString($length = 24, $complexChars = false)
if (function_exists('openssl_random_pseudo_bytes') && USE_OPENSSL_RANDOM && !$complexChars) {
$password = base64_encode(openssl_random_pseudo_bytes($length, $strong));
if($strong == TRUE)
return substr(str_replace(array("/","+"), "", $password), 0, $length); //base64 is about 33% longer, so we need to truncate the result
return substr(str_replace(array("/","+","="), "", $password), 0, $length); //base64 is about 33% longer, so we need to truncate the result
}

//fallback to mt_rand if php < 5.3 or no openssl available
Expand Down

0 comments on commit 545910c

Please sign in to comment.