@@ -35,26 +35,6 @@ union rand_long_buffer {
35
35
long number ;
36
36
};
37
37
38
- /*
39
- // Copy/pasted from string.c
40
- static char hexconvtab[] = "0123456789abcdef";
41
-
42
- // Copy/pasted from string.c
43
- static void php_bin_to_hex(zend_string *old, const zend_long old_len, zend_string *hex)
44
- {
45
- zend_long i, j;
46
-
47
- hex = zend_string_alloc(old_len * 2, 0); // @todo is this right?
48
-
49
- for (i = j = 0; i < old_len; i++) {
50
- hex->val[j++] = hexconvtab[old->val[i] >> 4];
51
- hex->val[j++] = hexconvtab[old->val[i] & 15];
52
- }
53
-
54
- hex->val[j] = '\0';
55
- }
56
- */
57
-
58
38
// Copy/pasted from mcrypt.c
59
39
static int php_random_bytes (char * bytes , zend_long size )
60
40
{
@@ -127,39 +107,6 @@ PHP_FUNCTION(random_bytes)
127
107
}
128
108
/* }}} */
129
109
130
- /* {{{ proto string random_hex(int bytes)
131
- Return an arbitrary length of pseudo-random bytes as hexadecimal string */
132
- PHP_FUNCTION (random_hex )
133
- {
134
- /*
135
- zend_long size;
136
- zend_string *bytes;
137
- zend_string *hex;
138
-
139
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &size) == FAILURE) {
140
- return;
141
- }
142
-
143
- if (size <= 0 || size >= INT_MAX) {
144
- php_error_docref(NULL, E_WARNING, "Cannot genrate a random string with a size of less than 1 or greater than %d", INT_MAX);
145
- RETURN_FALSE;
146
- }
147
-
148
- if (php_random_bytes(bytes, size) == FAILURE) {
149
- return;
150
- }
151
-
152
- int hex_size = size * 2;
153
-
154
- php_bin_to_hex(bytes, hex_size, hex);
155
-
156
- zend_string_release(bytes);
157
- */
158
-
159
- RETURN_STR ("Foo!" );
160
- }
161
- /* }}} */
162
-
163
110
/* {{{ proto int random_int(int maximum)
164
111
Return an arbitrary pseudo-random integer */
165
112
PHP_FUNCTION (random_int )
0 commit comments