php-internal-docs
8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
engine_secure.c
Go to the documentation of this file.
1
/*
2
+----------------------------------------------------------------------+
3
| Copyright (c) The PHP Group |
4
+----------------------------------------------------------------------+
5
| This source file is subject to version 3.01 of the PHP license, |
6
| that is bundled with this package in the file LICENSE, and is |
7
| available through the world-wide-web at the following url: |
8
| https://www.php.net/license/3_01.txt |
9
| If you did not receive a copy of the PHP license and are unable to |
10
| obtain it through the world-wide-web, please send a note to |
11
| license@php.net so we can mail you a copy immediately. |
12
+----------------------------------------------------------------------+
13
| Authors: Sammy Kaye Powers <me@sammyk.me> |
14
| Go Kudo <zeriyoshi@php.net> |
15
+----------------------------------------------------------------------+
16
*/
17
18
#ifdef HAVE_CONFIG_H
19
# include "config.h"
20
#endif
21
22
#include "
php.h
"
23
#include "
php_random.h
"
24
#include "
php_random_csprng.h
"
25
26
#include "
Zend/zend_exceptions.h
"
27
28
static
php_random_result
generate(
void
*
state
)
29
{
30
zend_ulong
r = 0;
31
32
php_random_bytes_throw(&r,
sizeof
(r));
33
34
return
(
php_random_result
){
35
.size =
sizeof
(
zend_ulong
),
36
.
result
= r,
37
};
38
}
39
40
static
zend_long
range(
void
*
state
,
zend_long
min
,
zend_long
max
)
41
{
42
zend_long
result
= 0;
43
44
php_random_int_throw(
min
,
max
, &
result
);
45
46
return
result
;
47
}
48
49
PHPAPI
const
php_random_algo
php_random_algo_secure
= {
50
0,
51
generate,
52
range,
53
NULL
,
54
NULL
55
};
php_random_algo_secure
PHPAPI const php_random_algo php_random_algo_secure
Definition
engine_secure.c:49
max
#define max(a, b)
Definition
exif.c:60
NULL
#define NULL
Definition
gdcache.h:45
php.h
PHPAPI
#define PHPAPI
Definition
php.h:71
state
state
Definition
php_http_parser.h:114
min
#define min(a, b)
Definition
php_pdo_firebird_int.h:55
php_random.h
php_random_algo
struct _php_random_algo php_random_algo
php_random_result
struct _php_random_result php_random_result
php_random_csprng.h
zend_exceptions.h
zend_long
int32_t zend_long
Definition
zend_long.h:42
zend_ulong
uint32_t zend_ulong
Definition
zend_long.h:43
result
bool result
Definition
zend_vm_def.h:455
ext
random
engine_secure.c
Generated on Sat Aug 23 2025 01:46:11 for php-internal-docs by
1.13.2