ILIAS
release_8 Revision v8.23
◀ ilDoc Overview
class.ilPasswordUtils.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
26
class
ilPasswordUtils
27
{
32
public
static
function
getBytes
(
int
$length): string
33
{
34
try
{
35
return
random_bytes($length);
36
}
catch
(
Throwable
$e
) {
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
}
53
}
Vendor\Package\$e
$e
Definition:
example_cleaned.php:49
ilPasswordUtils
Definition:
class.ilPasswordUtils.php:26
ilPasswordUtils\getBytes
static getBytes(int $length)
Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback.
Definition:
class.ilPasswordUtils.php:32
$i
$i
Definition:
metadata.php:41
Throwable
Services
Password
classes
class.ilPasswordUtils.php
Generated on Sun Aug 31 2025 22:02:29 for ILIAS by
1.8.13 (using
Doxyfile
)