Back to index

php5  5.3.10
Classes | Functions
php_hash_gost.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_GOST_CTX

Functions

PHP_HASH_API void PHP_GOSTInit (PHP_GOST_CTX *)
PHP_HASH_API void PHP_GOSTUpdate (PHP_GOST_CTX *, const unsigned char *, size_t)
PHP_HASH_API void PHP_GOSTFinal (unsigned char[64], PHP_GOST_CTX *)

Class Documentation

struct PHP_GOST_CTX

Definition at line 27 of file php_hash_gost.h.

Class Members
unsigned char buffer
php_hash_uint32 count
unsigned char length
php_hash_uint32 state

Function Documentation

PHP_HASH_API void PHP_GOSTFinal ( unsigned  char[64],
PHP_GOST_CTX  
)

Definition at line 243 of file hash_gost.c.

{
       memset(context, 0, sizeof(*context));
}
PHP_HASH_API void PHP_GOSTUpdate ( PHP_GOST_CTX ,
const unsigned char *  ,
size_t   
)

Definition at line 250 of file hash_gost.c.

{
       if ((MAX32 - context->count[0]) < (len * 8)) {
              context->count[1]++;
              context->count[0] = MAX32 - context->count[0];
              context->count[0] = (len * 8) - context->count[0];
       } else {
              context->count[0] += len * 8;
       }
       
       if (context->length + len < 32) {
              memcpy(&context->buffer[context->length], input, len);
              context->length += len;
       } else {
              size_t i = 0, r = (context->length + len) % 32;
              
              if (context->length) {
                     i = 32 - context->length;
                     memcpy(&context->buffer[context->length], input, i);
                     GostTransform(context, context->buffer);
              }
              
              for (; i + 32 <= len; i += 32) {
                     GostTransform(context, input + i);
              }
              
              memcpy(context->buffer, input + i, r);
              memset(&context->buffer[r], 0, 32 - r);
              context->length = r;
       }
}

Here is the call graph for this function: