19
19
#include "php.h"
20
20
#include "md5.h"
21
21
22
- PHPAPI void make_digest (char * md5str , const unsigned char * digest ) /* {{{ */
22
+ PHPAPI void make_digest (char * md5str , const unsigned char * digest )
23
23
{
24
24
make_digest_ex (md5str , digest , 16 );
25
25
}
26
- /* }}} */
27
26
28
- PHPAPI void make_digest_ex (char * md5str , const unsigned char * digest , int len ) /* {{{ */
27
+ PHPAPI void make_digest_ex (char * md5str , const unsigned char * digest , size_t len )
29
28
{
30
29
static const char hexits [17 ] = "0123456789abcdef" ;
31
- int i ;
32
30
33
- for (i = 0 ; i < len ; i ++ ) {
31
+ for (size_t i = 0 ; i < len ; i ++ ) {
34
32
md5str [i * 2 ] = hexits [digest [i ] >> 4 ];
35
33
md5str [(i * 2 ) + 1 ] = hexits [digest [i ] & 0x0F ];
36
34
}
37
35
md5str [len * 2 ] = '\0' ;
38
36
}
39
- /* }}} */
40
37
41
- /* {{{ Calculate the md5 hash of a string */
38
+ /* Calculate the md5 hash of a string */
42
39
PHP_FUNCTION (md5 )
43
40
{
44
41
zend_string * arg ;
45
- bool raw_output = 0 ;
46
42
PHP_MD5_CTX context ;
47
43
unsigned char digest [16 ];
44
+ bool raw_output = false;
48
45
49
46
ZEND_PARSE_PARAMETERS_START (1 , 2 )
50
47
Z_PARAM_STR (arg )
@@ -63,14 +60,13 @@ PHP_FUNCTION(md5)
63
60
}
64
61
65
62
}
66
- /* }}} */
67
63
68
- /* {{{ Calculate the md5 hash of given filename */
64
+ /* Calculate the md5 hash of given filename */
69
65
PHP_FUNCTION (md5_file )
70
66
{
71
67
char * arg ;
72
68
size_t arg_len ;
73
- bool raw_output = 0 ;
69
+ bool raw_output = false ;
74
70
unsigned char buf [1024 ];
75
71
unsigned char digest [16 ];
76
72
PHP_MD5_CTX context ;
@@ -113,7 +109,6 @@ PHP_FUNCTION(md5_file)
113
109
make_digest_ex (Z_STRVAL_P (return_value ), digest , 16 );
114
110
}
115
111
}
116
- /* }}} */
117
112
118
113
/*
119
114
* This is an OpenSSL-compatible implementation of the RSA Data Security,
0 commit comments