From d38911e5b97725a28d12b07f3842a452e6acba36 Mon Sep 17 00:00:00 2001 From: ColonelMoutarde <4697568+ColonelMoutarde@users.noreply.github.com> Date: Thu, 23 Aug 2018 19:57:45 +0200 Subject: Better rand() (#1976) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://php.net/manual/en/function.mt-rand.php from php Doc "Many random number generators of older libcs have dubious or unknown characteristics and are slow. The mt_rand() function is a drop-in replacement for the older rand(). It uses a random number generator with known characteristics using the ยป Mersenne Twister, which will produce random numbers four times faster than what the average libc rand() provides. " --- app/Controllers/javascriptController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Controllers/javascriptController.php') diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 6336106a9..9d7acf647 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -47,8 +47,8 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { $this->view->salt1 = sprintf('$2a$%02d$', FreshRSS_user_Controller::BCRYPT_COST); $alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for ($i = 22; $i > 0; $i--) { - $this->view->salt1 .= $alphabet[rand(0, 63)]; + $this->view->salt1 .= $alphabet[mt_rand(0, 63)]; } - $this->view->nonce = sha1(rand()); + $this->view->nonce = sha1(mt_rand()); } } -- cgit v1.2.3