char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char md5str[33];
PHP_MD5_CTX context;
unsigned char digest[16];
return;
}
- md5str[0] = '\0';
PHP_MD5Init(&context);
PHP_MD5Update(&context, arg, arg_len);
PHP_MD5Final(digest, &context);
if (raw_output) {
RETURN_STRINGL(digest, 16);
} else {
- make_digest(md5str, digest);
- RETVAL_STRING(md5str);
+ RETVAL_NEW_STR(zend_string_alloc(32, 0));
+ make_digest(Z_STRVAL_P(return_value), digest);
}
}
char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char md5str[33];
unsigned char buf[1024];
unsigned char digest[16];
PHP_MD5_CTX context;
if (raw_output) {
RETURN_STRINGL(digest, 16);
} else {
- make_digest(md5str, digest);
- RETVAL_STRING(md5str);
+ RETVAL_NEW_STR(zend_string_alloc(32, 0));
+ make_digest(Z_STRVAL_P(return_value), digest);
}
}
/* }}} */
char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char sha1str[41];
PHP_SHA1_CTX context;
unsigned char digest[20];
return;
}
- sha1str[0] = '\0';
PHP_SHA1Init(&context);
PHP_SHA1Update(&context, arg, arg_len);
PHP_SHA1Final(digest, &context);
if (raw_output) {
RETURN_STRINGL(digest, 20);
} else {
- make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str);
+ RETVAL_NEW_STR(zend_string_alloc(40, 0));
+ make_sha1_digest(Z_STRVAL_P(return_value), digest);
}
}
char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char sha1str[41];
unsigned char buf[1024];
unsigned char digest[20];
PHP_SHA1_CTX context;
if (raw_output) {
RETURN_STRINGL(digest, 20);
} else {
- make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str);
+ RETVAL_NEW_STR(zend_string_alloc(40, 0));
+ make_sha1_digest(Z_STRVAL_P(return_value), digest);
}
}
/* }}} */
/* Append NULL to the end of the string */
buff[ret] = '\0';
- RETURN_STRING(buff);
+ RETURN_STRINGL(buff, ret);
}
/* }}} */
{
zend_string *arg;
zend_bool raw_output = 0;
- char md5str[33];
PHP_MD5_CTX context;
unsigned char digest[16];
Z_PARAM_BOOL(raw_output)
ZEND_PARSE_PARAMETERS_END();
- md5str[0] = '\0';
PHP_MD5Init(&context);
PHP_MD5Update(&context, ZSTR_VAL(arg), ZSTR_LEN(arg));
PHP_MD5Final(digest, &context);
if (raw_output) {
RETURN_STRINGL((char *) digest, 16);
} else {
- make_digest_ex(md5str, digest, 16);
- RETVAL_STRING(md5str);
+ RETVAL_NEW_STR(zend_string_alloc(32, 0));
+ make_digest_ex(Z_STRVAL_P(return_value), digest, 16);
}
}
char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char md5str[33];
unsigned char buf[1024];
unsigned char digest[16];
PHP_MD5_CTX context;
if (raw_output) {
RETURN_STRINGL((char *) digest, 16);
} else {
- make_digest_ex(md5str, digest, 16);
- RETVAL_STRING(md5str);
+ RETVAL_NEW_STR(zend_string_alloc(32, 0));
+ make_digest_ex(Z_STRVAL_P(return_value), digest, 16);
}
}
/* }}} */
{
zend_string *arg;
zend_bool raw_output = 0;
- char sha1str[41];
PHP_SHA1_CTX context;
unsigned char digest[20];
Z_PARAM_BOOL(raw_output)
ZEND_PARSE_PARAMETERS_END();
- sha1str[0] = '\0';
PHP_SHA1Init(&context);
PHP_SHA1Update(&context, (unsigned char *) ZSTR_VAL(arg), ZSTR_LEN(arg));
PHP_SHA1Final(digest, &context);
if (raw_output) {
RETURN_STRINGL((char *) digest, 20);
} else {
- make_digest_ex(sha1str, digest, 20);
- RETVAL_STRING(sha1str);
+ RETVAL_NEW_STR(zend_string_alloc(40, 0));
+ make_digest_ex(Z_STRVAL_P(return_value), digest, 20);
}
}
char *arg;
size_t arg_len;
zend_bool raw_output = 0;
- char sha1str[41];
unsigned char buf[1024];
unsigned char digest[20];
PHP_SHA1_CTX context;
if (raw_output) {
RETURN_STRINGL((char *) digest, 20);
} else {
- make_digest_ex(sha1str, digest, 20);
- RETVAL_STRING(sha1str);
+ RETVAL_NEW_STR(zend_string_alloc(40, 0));
+ make_digest_ex(Z_STRVAL_P(return_value), digest, 20);
}
}
/* }}} */