inc/md5.h File Reference

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

Go to the source code of this file.

Data Structures

struct  md5_context

Defines

#define uint8   unsigned char
#define uint32   unsigned long int
#define uint64   unsigned long long int

Functions

void md5_starts (struct md5_context *ctx)
void md5_update (struct md5_context *ctx, uint8 *input, uint32 length)
void md5_finish (struct md5_context *ctx, uint8 digest[16])


Define Documentation

#define uint32   unsigned long int

Definition at line 5 of file md5.h.

Referenced by md5_finish(), md5_process(), and md5_update().

#define uint64   unsigned long long int

Definition at line 6 of file md5.h.

#define uint8   unsigned char

Definition at line 4 of file md5.h.

Referenced by md5_finish().


Function Documentation

void md5_finish ( struct md5_context ctx,
uint8  digest[16] 
)

Definition at line 201 of file md5.c.

References md5_padding, md5_update(), PUT_UINT32, md5_context::total, uint32, and uint8.

00202 {
00203     uint32 last, padn;
00204     uint8 msglen[8];
00205 
00206     PUT_UINT32( (uint32) ((ctx->total <<  3) & 0xFFFFFFFF), msglen, 0 );
00207     PUT_UINT32( (uint32) ((ctx->total >> 29) & 0xFFFFFFFF), msglen, 4 );
00208 
00209     last = (uint32) (ctx->total & 0x3F);
00210     padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
00211 
00212     md5_update( ctx, md5_padding, padn );
00213     md5_update( ctx, msglen, 8 );
00214 
00215     PUT_UINT32( ctx->state[0], digest,  0 );
00216     PUT_UINT32( ctx->state[1], digest,  4 );
00217     PUT_UINT32( ctx->state[2], digest,  8 );
00218     PUT_UINT32( ctx->state[3], digest, 12 );
00219 }

Here is the call graph for this function:

void md5_starts ( struct md5_context ctx  ) 

Definition at line 28 of file md5.c.

References md5_context::state, and md5_context::total.

00029 {
00030     ctx->total = 0;
00031     ctx->state[0] = 0x67452301;
00032     ctx->state[1] = 0xEFCDAB89;
00033     ctx->state[2] = 0x98BADCFE;
00034     ctx->state[3] = 0x10325476;
00035 }

void md5_update ( struct md5_context ctx,
uint8 *  input,
uint32  length 
)

Definition at line 160 of file md5.c.

References md5_context::buffer, md5_process(), md5_context::total, and uint32.

Referenced by md5_finish().

00161 {
00162     uint32 left, fill;
00163 
00164     if( ! length ) return;
00165 
00166     left = (uint32) (ctx->total & 0x3F);
00167     fill = 64 - left;
00168 
00169     ctx->total += length;
00170 
00171     if( left && length >= fill )
00172     {
00173         memcpy( (void *) (ctx->buffer + left), (void *) input, fill );
00174         md5_process( ctx, ctx->buffer );
00175         length -= fill;
00176         input  += fill;
00177         left = 0;
00178     }
00179 
00180     while( length >= 64 )
00181     {
00182         md5_process( ctx, input );
00183         length -= 64;
00184         input  += 64;
00185     }
00186 
00187     if( length )
00188     {
00189         memcpy( (void *) (ctx->buffer + left), (void *) input, length );
00190     }
00191 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 19:05:21 2007 for blat by  doxygen 1.5.2