Permalink
Browse files

change order

  • Loading branch information...
haraldpdl committed Feb 18, 2014
1 parent 3f46277 commit aa73d305761e8edcc527dc1b659d930e38a6c84e
Showing with 9 additions and 9 deletions.
  1. +9 −9 osCommerce/OM/Core/Hash.php
@@ -99,22 +99,22 @@ public static function getRandomBytes($length) {
$result = '';
- if ( @is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb')) ) {
- if ( function_exists('stream_set_read_buffer') ) {
- stream_set_read_buffer($fh, 0);
- }
-
- $result = fread($fh, $length);
-
- fclose($fh);
- } elseif ( function_exists('openssl_random_pseudo_bytes') ) {
+ if ( function_exists('openssl_random_pseudo_bytes') ) {
$result = openssl_random_pseudo_bytes($length, $orpb_secure);
if ( $orpb_secure != true ) {
$result = '';
}
} elseif ( defined('MCRYPT_DEV_URANDOM') ) {
$result = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
+ } elseif ( @is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb')) ) {
+ if ( function_exists('stream_set_read_buffer') ) {
+ stream_set_read_buffer($fh, 0);
+ }
+
+ $result = fread($fh, $length);
+
+ fclose($fh);
}
if ( strlen($result) < $length) {

0 comments on commit aa73d30

Please sign in to comment.