aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2016-02-17 22:10:09 +0100
committerTristan Darricau <tristan.darricau@sensiolabs.com>2016-02-18 17:30:31 +0100
commit58359b158716d6dc752c6a50b05b8dea7d5dfff4 (patch)
tree1676fe8e315bf6a79f3779d15f1ea28a407ddb26 /phpBB/includes/functions.php
parent08a11dbe32031e4cb2b79b6634e50edd115488d7 (diff)
downloadforums-58359b158716d6dc752c6a50b05b8dea7d5dfff4.tar
forums-58359b158716d6dc752c6a50b05b8dea7d5dfff4.tar.gz
forums-58359b158716d6dc752c6a50b05b8dea7d5dfff4.tar.bz2
forums-58359b158716d6dc752c6a50b05b8dea7d5dfff4.tar.xz
forums-58359b158716d6dc752c6a50b05b8dea7d5dfff4.zip
[ticket/14457] Replaces unique_id implementation by random_bytes()
PHPBB3-14457
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php19
1 files changed, 2 insertions, 17 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 54ff51dda5..5125a601d6 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -93,25 +93,10 @@ function gen_rand_string_friendly($num_chars = 8)
/**
* Return unique id
-* @param string $extra additional entropy
*/
-function unique_id($extra = 'c')
+function unique_id()
{
- static $dss_seeded = false;
- global $config;
-
- $val = $config['rand_seed'] . microtime();
- $val = md5($val);
- $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra);
-
- if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
- {
- $config->set('rand_seed_last_update', time(), false);
- $config->set('rand_seed', $config['rand_seed'], false);
- $dss_seeded = true;
- }
-
- return substr($val, 4, 16);
+ return bin2hex(random_bytes(6));
}
/**