summaryrefslogtreecommitdiff
path: root/ext/hash
diff options
context:
space:
mode:
authorMartin Jansen <mj@php.net>2010-03-28 10:01:02 +0000
committerMartin Jansen <mj@php.net>2010-03-28 10:01:02 +0000
commit71ec12cc78f2a69e9aa591df3b68850fcc0a3d81 (patch)
tree9d343b8f12f8659f433cddb33ca9d4ecda1c89bb /ext/hash
parent675ae35a8cfa209a7bf0b106a6eb71ef7bf48544 (diff)
downloadphp-git-71ec12cc78f2a69e9aa591df3b68850fcc0a3d81.tar.gz
JOAAT hashing now supports incremental hashing.
Diffstat (limited to 'ext/hash')
-rw-r--r--ext/hash/hash_joaat.c5
-rw-r--r--ext/hash/php_hash_joaat.h2
-rw-r--r--ext/hash/tests/hash_copy_001.phpt2
3 files changed, 4 insertions, 5 deletions
diff --git a/ext/hash/hash_joaat.c b/ext/hash/hash_joaat.c
index aa0770c47f..ccfa8e1837 100644
--- a/ext/hash/hash_joaat.c
+++ b/ext/hash/hash_joaat.c
@@ -42,7 +42,7 @@ PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context)
PHP_HASH_API void PHP_JOAATUpdate(PHP_JOAAT_CTX *context, const unsigned char *input, unsigned int inputLen)
{
- context->state = joaat_buf((void *)input, inputLen);
+ context->state = joaat_buf((void *)input, inputLen, context->state);
}
PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[4], PHP_JOAAT_CTX * context)
@@ -71,9 +71,8 @@ PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[4], PHP_JOAAT_CTX * contex
* 32 bit hash as a static hash type
*/
static php_hash_uint32
-joaat_buf(void *buf, size_t len)
+joaat_buf(void *buf, size_t len, php_hash_uint32 hval)
{
- php_hash_uint32 hval = 0;
size_t i;
unsigned char *input = (unsigned char *)buf;
diff --git a/ext/hash/php_hash_joaat.h b/ext/hash/php_hash_joaat.h
index 4f1dccc2d8..2bf6d8adf5 100644
--- a/ext/hash/php_hash_joaat.h
+++ b/ext/hash/php_hash_joaat.h
@@ -29,7 +29,7 @@ PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context);
PHP_HASH_API void PHP_JOAATUpdate(PHP_JOAAT_CTX *context, const unsigned char *input, unsigned int inputLen);
PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[16], PHP_JOAAT_CTX * context);
-static php_hash_uint32 joaat_buf(void *buf, size_t len);
+static php_hash_uint32 joaat_buf(void *buf, size_t len, php_hash_uint32 hval);
#endif
diff --git a/ext/hash/tests/hash_copy_001.phpt b/ext/hash/tests/hash_copy_001.phpt
index 12f3d56384..84d95945f7 100644
--- a/ext/hash/tests/hash_copy_001.phpt
+++ b/ext/hash/tests/hash_copy_001.phpt
@@ -253,7 +253,7 @@ string(16) "14522659f8138684"
string(16) "5e8c64fba6a5ffcf"
string(5) "joaat"
string(8) "aaebf370"
-string(8) "72e280c2"
+string(8) "513479b4"
string(10) "haval128,3"
string(32) "86362472c8895e68e223ef8b3711d8d9"
string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"