Back to index

php5  5.3.10
Classes | Functions
php_hash_ripemd.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_RIPEMD128_CTX
struct  PHP_RIPEMD160_CTX
struct  PHP_RIPEMD256_CTX
struct  PHP_RIPEMD320_CTX

Functions

PHP_HASH_API void PHP_RIPEMD128Init (PHP_RIPEMD128_CTX *)
PHP_HASH_API void PHP_RIPEMD128Update (PHP_RIPEMD128_CTX *, const unsigned char *, unsigned int)
PHP_HASH_API void PHP_RIPEMD128Final (unsigned char[16], PHP_RIPEMD128_CTX *)
PHP_HASH_API void PHP_RIPEMD160Init (PHP_RIPEMD160_CTX *)
PHP_HASH_API void PHP_RIPEMD160Update (PHP_RIPEMD160_CTX *, const unsigned char *, unsigned int)
PHP_HASH_API void PHP_RIPEMD160Final (unsigned char[20], PHP_RIPEMD160_CTX *)
PHP_HASH_API void PHP_RIPEMD256Init (PHP_RIPEMD256_CTX *)
PHP_HASH_API void PHP_RIPEMD256Update (PHP_RIPEMD256_CTX *, const unsigned char *, unsigned int)
PHP_HASH_API void PHP_RIPEMD256Final (unsigned char[32], PHP_RIPEMD256_CTX *)
PHP_HASH_API void PHP_RIPEMD320Init (PHP_RIPEMD320_CTX *)
PHP_HASH_API void PHP_RIPEMD320Update (PHP_RIPEMD320_CTX *, const unsigned char *, unsigned int)
PHP_HASH_API void PHP_RIPEMD320Final (unsigned char[40], PHP_RIPEMD320_CTX *)

Class Documentation

struct PHP_RIPEMD128_CTX

Definition at line 26 of file php_hash_ripemd.h.

Class Members
unsigned char buffer
php_hash_uint32 count
php_hash_uint32 state
struct PHP_RIPEMD160_CTX

Definition at line 32 of file php_hash_ripemd.h.

Class Members
unsigned char buffer
php_hash_uint32 count
php_hash_uint32 state
struct PHP_RIPEMD256_CTX

Definition at line 38 of file php_hash_ripemd.h.

Class Members
unsigned char buffer
php_hash_uint32 count
php_hash_uint32 state
struct PHP_RIPEMD320_CTX

Definition at line 44 of file php_hash_ripemd.h.

Class Members
unsigned char buffer
php_hash_uint32 count
php_hash_uint32 state

Function Documentation

PHP_HASH_API void PHP_RIPEMD128Final ( unsigned  char[16],
PHP_RIPEMD128_CTX  
)

Definition at line 624 of file hash_ripemd.c.

{
       unsigned char bits[8];
       unsigned int index, padLen;

       /* Save number of bits */
       bits[0] = (unsigned char) (context->count[0] & 0xFF);
       bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
       bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
       bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
       bits[4] = (unsigned char) (context->count[1] & 0xFF);
       bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
       bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
       bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
       
       /* Pad out to 56 mod 64.
        */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
       padLen = (index < 56) ? (56 - index) : (120 - index);
       PHP_RIPEMD128Update(context, PADDING, padLen);

       /* Append length (before padding) */
       PHP_RIPEMD128Update(context, bits, 8);

       /* Store state in digest */
       RIPEMDEncode(digest, context->state, 16);

       /* Zeroize sensitive information.
        */
       memset((unsigned char*) context, 0, sizeof(*context));
}

Here is the call graph for this function:

Definition at line 71 of file hash_ripemd.c.

{
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants.
        */
       context->state[0] = 0x67452301;
       context->state[1] = 0xEFCDAB89;
       context->state[2] = 0x98BADCFE;
       context->state[3] = 0x10325476; 
}
PHP_HASH_API void PHP_RIPEMD128Update ( PHP_RIPEMD128_CTX ,
const unsigned char *  ,
unsigned  int 
)

Definition at line 256 of file hash_ripemd.c.

{
       unsigned int i, index, partLen;

       /* Compute number of bytes mod 64 */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3F);

       /* 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 = 64 - index;

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

              for (i = partLen; i + 63 < inputLen; i += 64) {
                     RIPEMD128Transform(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 call graph for this function:

Here is the caller graph for this function:

PHP_HASH_API void PHP_RIPEMD160Final ( unsigned  char[20],
PHP_RIPEMD160_CTX  
)

Definition at line 698 of file hash_ripemd.c.

{
       unsigned char bits[8];
       unsigned int index, padLen;

       /* Save number of bits */
       bits[0] = (unsigned char) (context->count[0] & 0xFF);
       bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
       bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
       bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
       bits[4] = (unsigned char) (context->count[1] & 0xFF);
       bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
       bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
       bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
       
       /* Pad out to 56 mod 64.
        */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
       padLen = (index < 56) ? (56 - index) : (120 - index);
       PHP_RIPEMD160Update(context, PADDING, padLen);

       /* Append length (before padding) */
       PHP_RIPEMD160Update(context, bits, 8);

       /* Store state in digest */
       RIPEMDEncode(digest, context->state, 20);

       /* Zeroize sensitive information.
        */
       memset((unsigned char*) context, 0, sizeof(*context));
}

Here is the call graph for this function:

Definition at line 105 of file hash_ripemd.c.

{
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants.
        */
       context->state[0] = 0x67452301;
       context->state[1] = 0xEFCDAB89;
       context->state[2] = 0x98BADCFE;
       context->state[3] = 0x10325476; 
       context->state[4] = 0xC3D2E1F0;
}
PHP_HASH_API void PHP_RIPEMD160Update ( PHP_RIPEMD160_CTX ,
const unsigned char *  ,
unsigned  int 
)

Definition at line 453 of file hash_ripemd.c.

{
       unsigned int i, index, partLen;

       /* Compute number of bytes mod 64 */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3F);

       /* 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 = 64 - index;

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

              for (i = partLen; i + 63 < inputLen; i += 64) {
                     RIPEMD160Transform(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 call graph for this function:

Here is the caller graph for this function:

PHP_HASH_API void PHP_RIPEMD256Final ( unsigned  char[32],
PHP_RIPEMD256_CTX  
)

Definition at line 661 of file hash_ripemd.c.

{
       unsigned char bits[8];
       unsigned int index, padLen;

       /* Save number of bits */
       bits[0] = (unsigned char) (context->count[0] & 0xFF);
       bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
       bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
       bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
       bits[4] = (unsigned char) (context->count[1] & 0xFF);
       bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
       bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
       bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
       
       /* Pad out to 56 mod 64.
        */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
       padLen = (index < 56) ? (56 - index) : (120 - index);
       PHP_RIPEMD256Update(context, PADDING, padLen);

       /* Append length (before padding) */
       PHP_RIPEMD256Update(context, bits, 8);

       /* Store state in digest */
       RIPEMDEncode(digest, context->state, 32);

       /* Zeroize sensitive information.
        */
       memset((unsigned char*) context, 0, sizeof(*context));
}

Here is the call graph for this function:

Definition at line 86 of file hash_ripemd.c.

{
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants.
        */
       context->state[0] = 0x67452301;
       context->state[1] = 0xEFCDAB89;
       context->state[2] = 0x98BADCFE;
       context->state[3] = 0x10325476; 
       context->state[4] = 0x76543210;
       context->state[5] = 0xFEDCBA98;
       context->state[6] = 0x89ABCDEF;
       context->state[7] = 0x01234567;
}
PHP_HASH_API void PHP_RIPEMD256Update ( PHP_RIPEMD256_CTX ,
const unsigned char *  ,
unsigned  int 
)

Definition at line 354 of file hash_ripemd.c.

{
       unsigned int i, index, partLen;

       /* Compute number of bytes mod 64 */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3F);

       /* 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 = 64 - index;

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

              for (i = partLen; i + 63 < inputLen; i += 64) {
                     RIPEMD256Transform(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 call graph for this function:

Here is the caller graph for this function:

PHP_HASH_API void PHP_RIPEMD320Final ( unsigned  char[40],
PHP_RIPEMD320_CTX  
)

Definition at line 735 of file hash_ripemd.c.

{
       unsigned char bits[8];
       unsigned int index, padLen;

       /* Save number of bits */
       bits[0] = (unsigned char) (context->count[0] & 0xFF);
       bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
       bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
       bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
       bits[4] = (unsigned char) (context->count[1] & 0xFF);
       bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
       bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
       bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
       
       /* Pad out to 56 mod 64.
        */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
       padLen = (index < 56) ? (56 - index) : (120 - index);
       PHP_RIPEMD320Update(context, PADDING, padLen);

       /* Append length (before padding) */
       PHP_RIPEMD320Update(context, bits, 8);

       /* Store state in digest */
       RIPEMDEncode(digest, context->state, 40);

       /* Zeroize sensitive information.
        */
       memset((unsigned char*) context, 0, sizeof(*context));
}

Here is the call graph for this function:

Definition at line 121 of file hash_ripemd.c.

{
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants.
        */
       context->state[0] = 0x67452301;
       context->state[1] = 0xEFCDAB89;
       context->state[2] = 0x98BADCFE;
       context->state[3] = 0x10325476; 
       context->state[4] = 0xC3D2E1F0;
       context->state[5] = 0x76543210;
       context->state[6] = 0xFEDCBA98;
       context->state[7] = 0x89ABCDEF;
       context->state[8] = 0x01234567;
       context->state[9] = 0x3C2D1E0F;
}
PHP_HASH_API void PHP_RIPEMD320Update ( PHP_RIPEMD320_CTX ,
const unsigned char *  ,
unsigned  int 
)

Definition at line 561 of file hash_ripemd.c.

{
       unsigned int i, index, partLen;

       /* Compute number of bytes mod 64 */
       index = (unsigned int) ((context->count[0] >> 3) & 0x3F);

       /* 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 = 64 - index;

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

              for (i = partLen; i + 63 < inputLen; i += 64) {
                     RIPEMD320Transform(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 call graph for this function:

Here is the caller graph for this function: