}
/* }}} */
-static inline void TigerTransform(PHP_TIGER_CTX *context, const unsigned char *input, size_t length)
-{
- php_hash_uint64 i = (php_hash_uint64) length << 3;
- const php_hash_uint64 *ptr = (const php_hash_uint64 *) input;
-
- context->passed += i;
-
- for (; i >= 64; i -= 64) {
- tiger_compress(context->passes, ptr, context->state);
- ptr += 8;
- }
-}
-
static inline void TigerFinalize(PHP_TIGER_CTX *context)
{
context->passed += (php_hash_uint64) context->length << 3;
context->state[2] = L64(0xF096A5B4C3B2E187);
}
-PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, unsigned char *input, size_t len)
+PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len)
{
if (context->length + len < 64) {
memcpy(&context->buffer[context->length], input, len);
if (context->length) {
i = 64 - context->length;
memcpy(&context->buffer[context->length], input, i);
- TigerTransform(context, context->buffer, 64);
+ tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
memset(context->buffer, 0, 64);
+ context->passed += 512;
}
for (; i + 64 <= len; i += 64) {
- TigerTransform(context, input + i, 64);
+ tiger_compress(context->passes, ((const php_hash_uint64 *) (input + i)), context->state);
+ context->passed += 512;
}
memcpy(context->buffer, input + i, r);
PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context);
-PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, unsigned char *input, size_t len);
+PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context);
<?php
echo hash('tiger192,3', ''),"\n";
echo hash('tiger192,3', 'abc'),"\n";
+echo hash('tiger192,3', str_repeat('a', 63)),"\n";
echo hash('tiger192,3', str_repeat('abc', 61)),"\n";
echo hash('tiger192,3', str_repeat('abc', 64)),"\n";
?>
--EXPECT--
24f0130c63ac933216166e76b1bb925ff373de2d49584e7a
f258c1e88414ab2a527ab541ffc5b8bf935f7b951c132951
+8ee409a14e6066933b63d5b2abca63d71a78f55e29eb4649
2586156d16bf9ab1e6e48bdf5e038f8053c30e071db3bcb0
3ee8a9405396ddba1bc038508af4164ac1fe59ef58916a85
-