Hi,
I've forked out an interesting project on Github that implements XXHash and
extended it to work with the hash()
function family. Project links below.
The integration is pretty straightforward, but the following code had me
concerned:
PHP_HASH_API void PHP_XXH32Update(PHP_XXH32_CTX *context, const unsigned
char *input, unsigned int inputLen)
{
XXH32_feed(context->state, (void *)input, (int)inputLen);
}
The XXH32_feed() takes an int argument, whereas the update ops function
takes an unsigned int for the input length.
Would that ever give a problem? If so, what kind of workaround am I looking
at?
Thanks!
Project links:
php-xxhash: https://github.com/datibbaw/php-xxhash
XXHash: http://code.google.com/p/xxhash/
Em 2013-02-20 8:09, Tjerk Anne Meesters escreveu:
Hi,
I've forked out an interesting project on Github that implements
XXHash and
extended it to work with thehash()
function family. Project links
below.The integration is pretty straightforward, but the following code had
me
concerned:PHP_HASH_API void PHP_XXH32Update(PHP_XXH32_CTX *context, const
unsigned
char *input, unsigned int inputLen)
{
XXH32_feed(context->state, (void *)input, (int)inputLen);
}The XXH32_feed() takes an int argument, whereas the update ops
function
takes an unsigned int for the input length.Would that ever give a problem? If so, what kind of workaround am I
looking
at?
Not unless and unsigned int with a value larger than INT_MAX is passed.
I took a quick look at the calls to ->hash_update and the largest value
potentially passed seems to be from a PHP string (via
php_hash_hmac_round), which has an int for the length and therefore is
not a problem.
--
Gustavo Lopes