Back to index

php5  5.3.10
Classes | Functions
php_hash_tiger.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PHP_TIGER_CTX

Functions

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, 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)

Class Documentation

struct PHP_TIGER_CTX

Definition at line 25 of file php_hash_tiger.h.

Class Members
unsigned char buffer
unsigned int length:7
php_hash_uint64 passed
unsigned int passes:1
php_hash_uint64 state

Function Documentation

Definition at line 172 of file hash_tiger.c.

{
       memset(context, 0, sizeof(*context));
       context->state[0] = L64(0x0123456789ABCDEF);
       context->state[1] = L64(0xFEDCBA9876543210);
       context->state[2] = L64(0xF096A5B4C3B2E187);
}

Definition at line 180 of file hash_tiger.c.

{
       memset(context, 0, sizeof(*context));
       context->passes = 1;
       context->state[0] = L64(0x0123456789ABCDEF);
       context->state[1] = L64(0xFEDCBA9876543210);
       context->state[2] = L64(0xF096A5B4C3B2E187);
}
PHP_HASH_API void PHP_TIGER128Final ( unsigned char  digest[16],
PHP_TIGER_CTX context 
)

Definition at line 216 of file hash_tiger.c.

{
       TigerFinalize(context);
       
       digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
       digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
       digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
       digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
       digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
       digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
       digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
       digest[7] = (unsigned char) (context->state[0] & 0xff);
       digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
       digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
       digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
       digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
       digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
       digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
       digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
       digest[15] = (unsigned char) (context->state[1] & 0xff);
       
       memset(context, 0, sizeof(*context));
}

Here is the call graph for this function:

PHP_HASH_API void PHP_TIGER160Final ( unsigned char  digest[20],
PHP_TIGER_CTX context 
)

Definition at line 240 of file hash_tiger.c.

{
       TigerFinalize(context);
       
       digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
       digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
       digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
       digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
       digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
       digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
       digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
       digest[7] = (unsigned char) (context->state[0] & 0xff);
       digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
       digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
       digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
       digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
       digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
       digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
       digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
       digest[15] = (unsigned char) (context->state[1] & 0xff);
       digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff);
       digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff);
       digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff);
       digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff);
       
       memset(context, 0, sizeof(*context));
}

Here is the call graph for this function:

PHP_HASH_API void PHP_TIGER192Final ( unsigned char  digest[24],
PHP_TIGER_CTX context 
)

Definition at line 268 of file hash_tiger.c.

{
       TigerFinalize(context);
       
       digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
       digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
       digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
       digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
       digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
       digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
       digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
       digest[7] = (unsigned char) (context->state[0] & 0xff);
       digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
       digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
       digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
       digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
       digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
       digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
       digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
       digest[15] = (unsigned char) (context->state[1] & 0xff);
       digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff);
       digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff);
       digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff);
       digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff);
       digest[20] = (unsigned char) ((context->state[2] >> 24) & 0xff);
       digest[21] = (unsigned char) ((context->state[2] >> 16) & 0xff);
       digest[22] = (unsigned char) ((context->state[2] >> 8) & 0xff);
       digest[23] = (unsigned char) (context->state[2] & 0xff);
       
       memset(context, 0, sizeof(*context));
}

Here is the call graph for this function:

PHP_HASH_API void PHP_TIGERUpdate ( PHP_TIGER_CTX context,
const unsigned char *  input,
size_t  len 
)

Definition at line 189 of file hash_tiger.c.

{
       if (context->length + len < 64) {
              memcpy(&context->buffer[context->length], input, len);
              context->length += len;
       } else {
              size_t i = 0, r = (context->length + len) % 64;
              
              if (context->length) {
                     i = 64 - context->length;
                     memcpy(&context->buffer[context->length], input, i);
                     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) {
                     memcpy(context->buffer, &input[i], 64);
                     tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
                     context->passed += 512;
              }
              memset(&context->buffer[r], 0, 64-r);
              memcpy(context->buffer, &input[i], r);
              context->length = r;
       }
}