summaryrefslogtreecommitdiff
path: root/inc/PassHash.class.php
diff options
context:
space:
mode:
authorGerrit Uitslag <klapinklapin@gmail.com>2013-11-19 21:26:50 +0100
committerGerrit Uitslag <klapinklapin@gmail.com>2013-11-19 21:26:50 +0100
commit703aeaef1a43b07dc5497dba72c98151466396cc (patch)
tree1e18a6b3fc3c28156c2e56f8a3d515b8dd6a9cf9 /inc/PassHash.class.php
parent33c3b3817b00aa9384760813643fac0e33daaaff (diff)
parent14b3007921f7b66fc9e3621b861a3c83e7e9093c (diff)
downloadrpg-703aeaef1a43b07dc5497dba72c98151466396cc.tar.gz
rpg-703aeaef1a43b07dc5497dba72c98151466396cc.tar.bz2
Merge remote-tracking branch 'origin/master' into diff_navigation
Diffstat (limited to 'inc/PassHash.class.php')
-rw-r--r--inc/PassHash.class.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php
index 61bd74939..db6a3a77c 100644
--- a/inc/PassHash.class.php
+++ b/inc/PassHash.class.php
@@ -98,7 +98,7 @@ class PassHash {
$salt = '';
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for($i = 0; $i < $len; $i++) {
- $salt .= $chars[mt_rand(0, 61)];
+ $salt .= $chars[$this->random(0, 61)];
}
return $salt;
}
@@ -541,4 +541,20 @@ class PassHash {
return ($raw_output) ? pack($pack, $output) : $output;
}
+
+ /**
+ * Use DokuWiki's secure random generator if available
+ *
+ * @param $min
+ * @param $max
+ *
+ * @return int
+ */
+ protected function random($min, $max){
+ if(function_exists('auth_random')){
+ return auth_random($min, $max);
+ }else{
+ return mt_rand($min, $max);
+ }
+ }
}