Permalink
Browse files

cherrypicking 1763

  • Loading branch information...
padams
padams committed Feb 2, 2014
1 parent 98415be commit 92d7fb609541b017ccbf41b54304370202bb6f2b
Showing with 26 additions and 4 deletions.
  1. +26 −4 owa_coreAPI.php
View
@@ -1398,10 +1398,32 @@ public static function random($min, $max) {
static $rnd_value;
if ( strlen($rnd_value) < 8 ) {
$seed = microtime();
$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
$rnd_value .= sha1($rnd_value);
$rnd_value .= sha1($rnd_value . $seed);
$notrandom = false;
if ( function_exists( 'openssl_random_pseudo_bytes' ) ) {
$rnd_value = bin2hex(openssl_random_pseudo_bytes(32, $cstrong));
if ( ! $cstrong ) {
$notrandom = true;
}
} else {
$notrandom = true;
}
if ( $notrandom ) {
$seed = microtime();
$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
$rnd_value .= sha1($rnd_value);
$rnd_value .= sha1($rnd_value . $seed);
}
//$seed = md5($seed . $rnd_value);
}
// Take the first 8 digits for our value

0 comments on commit 92d7fb6

Please sign in to comment.