md5.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MD5_CTX

Functions

void MD5Init (MD5_CTX *context)
void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
void MD5Final (unsigned char digest[16], MD5_CTX *context)


Function Documentation

void MD5Final ( unsigned char  digest[16],
MD5_CTX context 
)

Definition at line 162 of file md5c.cpp.

References MD5_CTX::count, Encode(), MD5_memset(), MD5Update(), and PADDING.

Referenced by TAO_AV_RTCP::alloc_srcid().

00163 {
00164   unsigned char bits[8];
00165   unsigned int index, padLen;
00166 
00167   /* Save number of bits */
00168   Encode (bits, context->count, 8);
00169 
00170   /* Pad out to 56 mod 64.
00171 */
00172   index = (unsigned int)((context->count[0] >> 3) & 0x3f);
00173   padLen = (index < 56) ? (56 - index) : (120 - index);
00174   MD5Update (context, PADDING, padLen);
00175 
00176   /* Append length (before padding) */
00177   MD5Update (context, bits, 8);
00178 
00179   /* Store state in digest */
00180   Encode (digest, context->state, 16);
00181 
00182   /* Zeroize sensitive information.
00183 */
00184   MD5_memset ((POINTER)context, 0, sizeof (*context));
00185 }

void MD5Init ( MD5_CTX context  ) 

Definition at line 107 of file md5c.cpp.

References MD5_CTX::count, and MD5_CTX::state.

Referenced by TAO_AV_RTCP::alloc_srcid().

00108 {
00109   context->count[0] = context->count[1] = 0;
00110   /* Load magic initialization constants.
00111 */
00112   context->state[0] = 0x67452301;
00113   context->state[1] = 0xefcdab89;
00114   context->state[2] = 0x98badcfe;
00115   context->state[3] = 0x10325476;
00116 }

void MD5Update ( MD5_CTX context,
unsigned char *  input,
unsigned int  inputLen 
)

Definition at line 122 of file md5c.cpp.

References MD5_CTX::buffer, MD5_CTX::count, MD5_memcpy(), MD5Transform(), and MD5_CTX::state.

Referenced by TAO_AV_RTCP::alloc_srcid(), and MD5Final().

00123 {
00124   unsigned int i, index, partLen;
00125 
00126   /* Compute number of bytes mod 64 */
00127   index = (unsigned int)((context->count[0] >> 3) & 0x3F);
00128 
00129   /* Update number of bits */
00130   if ((context->count[0] += ((UINT4)inputLen << 3))
00131 
00132    < ((UINT4)inputLen << 3))
00133  context->count[1]++;
00134   context->count[1] += ((UINT4)inputLen >> 29);
00135 
00136   partLen = 64 - index;
00137 
00138   /* Transform as many times as possible.
00139 */
00140   if (inputLen >= partLen) {
00141  MD5_memcpy
00142    ((POINTER)&context->buffer[index], (POINTER)input, partLen);
00143  MD5Transform (context->state, context->buffer);
00144 
00145  for (i = partLen; i + 63 < inputLen; i += 64)
00146    MD5Transform (context->state, &input[i]);
00147 
00148  index = 0;
00149   }
00150   else
00151  i = 0;
00152 
00153   /* Buffer remaining input */
00154   MD5_memcpy
00155  ((POINTER)&context->buffer[index], (POINTER)&input[i],
00156   inputLen-i);
00157 }


Generated on Tue Feb 2 17:47:53 2010 for TAO_AV by  doxygen 1.4.7