Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

lib/md5.c File Reference

This code implements the MD5 message-digest algorithm. More...

#include "system.h"
#include "md5.h"
#include "debug.h"

Go to the source code of this file.

Compounds

union  _mendian

Defines

#define IS_BIG_ENDIAN()    (_endian->b[0] == '\x44')
#define IS_LITTLE_ENDIAN()    (_endian->b[0] == '\x11')
#define F1(x, y, z)    (z ^ (x & (y ^ z)))
#define F2(x, y, z)    F1(z, x, y)
#define F3(x, y, z)    (x ^ y ^ z)
#define F4(x, y, z)    (y ^ (x | ~z))
#define MD5STEP(f, w, x, y, z, data, s)

Functions

void byteReverse (unsigned char *buf, unsigned longs)
void rpmMD5Init (struct MD5Context *ctx, int brokenEndian)
 Initialize MD5 hash. More...

void rpmMD5Update (struct MD5Context *ctx, unsigned char const *buf, unsigned len)
 Update context to reflect the concatenation of another buffer full of bytes. More...

void rpmMD5Final (unsigned char digest[16], struct MD5Context *ctx)
 Return MD5 digest, and reset context. More...

void rpmMD5Transform (uint32 buf[4], uint32 const in[16])
 The core of the MD5 algorithm. More...


Variables

int _ie = 0x44332211
union _mendian_endian


Detailed Description

This code implements the MD5 message-digest algorithm.

The algorithm is due to Ron Rivest. This code was written by Colin Plumb in 1993, no copyright is claimed. This code is in the public domain; do with it what you wish.

Equivalent code is available from RSA Data Security, Inc. This code has been tested against that, and is equivalent, except that you don't need to include two pages of legalese with every copy.

To compute the message digest of a chunk of bytes, declare an MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as needed on buffers full of bytes, and then call rpmMD5Final, which will fill a supplied 16-byte array with the digest.

Todo:
Eliminate, use rpmio version instead.

Definition in file md5.c.


Define Documentation

#define F1( x, y, z )   (z ^ (x & (y ^ z)))
 

Definition at line 172 of file md5.c.

#define F2( x, y, z )   F1(z, x, y)
 

Definition at line 173 of file md5.c.

#define F3( x, y, z )   (x ^ y ^ z)
 

Definition at line 174 of file md5.c.

#define F4( x, y, z )   (y ^ (x | ~z))
 

Definition at line 175 of file md5.c.

#define IS_BIG_ENDIAN( )   (_endian->b[0] == '\x44')
 

Definition at line 27 of file md5.c.

Referenced by rpmDigestInit(), rpmMD5Init(), and rpmVerifyFile().

#define IS_LITTLE_ENDIAN( )   (_endian->b[0] == '\x11')
 

Definition at line 28 of file md5.c.

#define MD5STEP( f, w, x, y, z, data, s )
 

Initializer:

\
        ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )

Definition at line 178 of file md5.c.

Referenced by MD5Transform(), and rpmMD5Transform().


Function Documentation

void byteReverse ( unsigned char * buf,
unsigned longs )
 

Definition at line 35 of file md5.c.

void rpmMD5Final ( unsigned char digest[16],
struct MD5Context * context )
 

Return MD5 digest, and reset context.

Return values:
MD5   digest
Parameters:
context   MD5 private data

Definition at line 125 of file md5.c.

Referenced by domd5().

void rpmMD5Init ( struct MD5Context * context,
int brokenEndian )
 

Initialize MD5 hash.

Set bit count to 0 and buffer to mysterious initialization constants.

Parameters:
context   MD5 private data
brokenEndian   calculate broken MD5 sum?

Definition at line 50 of file md5.c.

Referenced by domd5().

void rpmMD5Transform ( uint32 buf[4],
uint32 const in[16] )
 

The core of the MD5 algorithm.

This alters an existing MD5 hash to reflect the addition of 16 longwords of new data.

Parameters:
buf   current MD5 variables
in   next block of data to add

Definition at line 186 of file md5.c.

Referenced by rpmMD5Final(), and rpmMD5Update().

void rpmMD5Update ( struct MD5Context * context,
unsigned char const * buf,
unsigned len )
 

Update context to reflect the concatenation of another buffer full of bytes.

Parameters:
context   MD5 private data
data   next data buffer
len   no. bytes of data

Definition at line 75 of file md5.c.

Referenced by domd5().


Variable Documentation

union _mendian * _endian [static]
 

int _ie = 0x44332211 [static]
 

Definition at line 358 of file digest.c.


Generated at Sun Apr 8 18:43:04 2001 for rpm by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000