aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorRubén Calvo <rubencm@gmail.com>2018-06-15 19:22:35 +0200
committerRubén Calvo <rubencm@gmail.com>2018-06-15 19:22:35 +0200
commitf75c400db44387863abbc0f6f2944df546d5a137 (patch)
tree6afcb11f438f121c5583c21c4481a7a18b76ee8a /phpBB/includes/functions.php
parent8b7ae7c796d9ffb9083502b869ecac0e15f73d58 (diff)
downloadforums-f75c400db44387863abbc0f6f2944df546d5a137.tar
forums-f75c400db44387863abbc0f6f2944df546d5a137.tar.gz
forums-f75c400db44387863abbc0f6f2944df546d5a137.tar.bz2
forums-f75c400db44387863abbc0f6f2944df546d5a137.tar.xz
forums-f75c400db44387863abbc0f6f2944df546d5a137.zip
[ticket/15693] Fix get_rand_string()
PHPBB3-15693
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 4aae84705b..3b3218a3aa 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -71,7 +71,7 @@ function set_var(&$result, $var, $type, $multibyte = false)
function gen_rand_string($num_chars = 8)
{
// [a, z] + [0, 9] = 36
- return substr(strtoupper(base_convert(unique_id(), 16, 36)), 0, $num_chars);
+ return substr(strtoupper(base_convert(bin2hex(random_bytes($num_chars)), 16, 36)), 0, $num_chars);
}
/**
@@ -82,7 +82,7 @@ function gen_rand_string($num_chars = 8)
*/
function gen_rand_string_friendly($num_chars = 8)
{
- $rand_str = unique_id();
+ $rand_str = bin2hex(random_bytes($num_chars));
// Remove Z and Y from the base_convert(), replace 0 with Z and O with Y
// [a, z] + [0, 9] - {z, y} = [a, z] + [0, 9] - {0, o} = 34