tony2001 Fri Apr 4 07:47:58 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/hash hash.c
Log:
MFH: fix folding
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.18.2.5.2.7.2.2&r2=1.18.2.5.2.7.2.3&diff_format=u
Index: php-src/ext/hash/hash.c
diff -u php-src/ext/hash/hash.c:1.18.2.5.2.7.2.2
php-src/ext/hash/hash.c:1.18.2.5.2.7.2.3
--- php-src/ext/hash/hash.c:1.18.2.5.2.7.2.2 Mon Dec 31 07:17:08 2007
+++ php-src/ext/hash/hash.c Fri Apr 4 07:47:58 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash.c,v 1.18.2.5.2.7.2.2 2007/12/31 07:17:08 sebastian Exp $ */
+/* $Id: hash.c,v 1.18.2.5.2.7.2.3 2008/04/04 07:47:58 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,7 +37,7 @@
/* Hash Registry Access */
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int
algo_len)
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int
algo_len) /* {{{ */
{
php_hash_ops *ops;
char *lower = estrndup(algo, algo_len);
@@ -50,8 +50,9 @@
return ops;
}
+/* }}} */
-PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops
*ops)
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops
*ops) /* {{{ */
{
int algo_len = strlen(algo);
char *lower = estrndup(algo, algo_len);
@@ -60,10 +61,11 @@
zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops,
sizeof(php_hash_ops), NULL);
efree(lower);
}
+/* }}} */
/* Userspace */
-static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
+static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) /*
{{{ */
{
char *algo, *data, *digest;
int algo_len, data_len;
@@ -120,11 +122,13 @@
RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0);
}
}
+/* }}} */
/* {{{ proto string hash(string algo, string data[, bool raw_output = false])
Generate a hash of a given input string
Returns lowercase hexits by default */
-PHP_FUNCTION(hash) {
+PHP_FUNCTION(hash)
+{
php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
@@ -132,12 +136,13 @@
/* {{{ proto string hash_file(string algo, string filename[, bool raw_output =
false])
Generate a hash of a given file
Returns lowercase hexits by default */
-PHP_FUNCTION(hash_file) {
+PHP_FUNCTION(hash_file)
+{
php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
-static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
+static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int
isfilename) /* {{{ */
{
char *algo, *data, *digest, *key, *K;
int algo_len, data_len, key_len, i;
@@ -229,11 +234,13 @@
RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0);
}
}
+/* }}} */
/* {{{ proto string hash_hmac(string algo, string data, string key[, bool
raw_output = false])
Generate a hash of a given input string with a key using HMAC
Returns lowercase hexits by default */
-PHP_FUNCTION(hash_hmac) {
+PHP_FUNCTION(hash_hmac)
+{
php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
@@ -241,7 +248,8 @@
/* {{{ proto string hash_hmac_file(string algo, string filename, string key[,
bool raw_output = false])
Generate a hash of a given file with a key using HMAC
Returns lowercase hexits by default */
-PHP_FUNCTION(hash_hmac_file) {
+PHP_FUNCTION(hash_hmac_file)
+{
php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
@@ -488,7 +496,7 @@
/* Module Housekeeping */
-static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
{
php_hash_data *hash = (php_hash_data*)rsrc->ptr;
@@ -506,6 +514,7 @@
}
efree(hash);
}
+/* }}} */
#define PHP_HASH_HAVAL_REGISTER(p,b) php_hash_register_algo("haval" #b ","
#p , &php_hash_##p##haval##b##_ops);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php