Back to index

php5  5.3.10
Classes | Defines | Functions
php_hash_haval.h File Reference
#include "ext/standard/basic_functions.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PHP_HAVAL_CTX

Defines

#define PHP_HASH_HAVAL_INIT_DECL(p, b)

Functions

PHP_HASH_API void PHP_HAVALUpdate (PHP_HAVAL_CTX *, const unsigned char *, unsigned int)

Define Documentation

#define PHP_HASH_HAVAL_INIT_DECL (   p,
 
)
Value:
PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *); \
                                                                      PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);

Definition at line 36 of file php_hash_haval.h.


Function Documentation

PHP_HASH_API void PHP_HAVALUpdate ( PHP_HAVAL_CTX ,
const unsigned char *  ,
unsigned  int 
)

Definition at line 285 of file hash_haval.c.

{
       unsigned int i, index, partLen;

       /* Compute number of bytes mod 128 */
       index = (unsigned int) ((context->count[0] >> 3) & 0x7F);
       /* Update number of bits */
       if ((context->count[0] += ((php_hash_uint32) inputLen << 3)) < ((php_hash_uint32) inputLen << 3)) {
              context->count[1]++;
       }
       context->count[1] += ((php_hash_uint32) inputLen >> 29);

       partLen = 128 - index;

       /* Transform as many times as possible.
        */
       if (inputLen >= partLen) {
              memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
              context->Transform(context->state, context->buffer);

              for (i = partLen; i + 127 < inputLen; i += 128) {
                     context->Transform(context->state, &input[i]);
              }

              index = 0;
       } else {
              i = 0;
       }

       /* Buffer remaining input */
       memcpy((unsigned char*) &context->buffer[index], (unsigned char*) &input[i], inputLen - i);
}

Here is the caller graph for this function: