ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPasswordUtils Class Reference
+ Collaboration diagram for ilPasswordUtils:

Static Public Member Functions

static getBytes (int $length)
 Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback. More...
 

Detailed Description

Definition at line 26 of file class.ilPasswordUtils.php.

Member Function Documentation

◆ getBytes()

static ilPasswordUtils::getBytes ( int  $length)
static

Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback.

Returns
string A byte string

Definition at line 32 of file class.ilPasswordUtils.php.

References null.

Referenced by ILIAS\Data\Password\LocalUserPasswordManager\encodePassword(), ilBcryptPasswordEncoder\generateClientSalt(), ILIAS\Init\PasswordAssitance\Repository\PasswordAssistanceDbRepository\generateHash(), and ilSimpleSAMLphpWrapper\initConfigFiles().

32  : string
33  {
34  try {
35  return random_bytes($length);
36  } catch (Throwable) {
37  if (!defined('PHP_WINDOWS_VERSION_BUILD') && extension_loaded('openssl')) {
38  $secure = null;
39  $rand = openssl_random_pseudo_bytes($length, $secure);
40  if (false !== $rand && $secure === true) {
41  return $rand;
42  }
43  }
44 
45  $rand = '';
46  for ($i = 0; $i < $length; ++$i) {
47  $rand .= chr(random_int(0, 255));
48  }
49 
50  return $rand;
51  }
52  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: