]> granicus.if.org Git - php/commitdiff
JOAAT hashing now supports incremental hashing.
authorMartin Jansen <mj@php.net>
Sun, 28 Mar 2010 10:01:02 +0000 (10:01 +0000)
committerMartin Jansen <mj@php.net>
Sun, 28 Mar 2010 10:01:02 +0000 (10:01 +0000)
ext/hash/hash_joaat.c
ext/hash/php_hash_joaat.h
ext/hash/tests/hash_copy_001.phpt

index aa0770c47f0a90e6ab15bf1165d094e6cdbc46e2..ccfa8e1837a63103916092e2f5ce55ddf9e8a054 100644 (file)
@@ -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;
  
index 4f1dccc2d84df36f4ef3155f18ea1eaa8328035f..2bf6d8adf5eda66b80bacdadd011ff7820c18ac3 100644 (file)
@@ -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
 
index 12f3d56384227a78964a559c1e75a35b1a18f8b2..84d95945f7caa9e6e0f16980fc12a5fd2e88c276 100644 (file)
@@ -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"