OpenVAS Libraries
4.0+rc3.SVN
|
00001 /* 00002 * This code implements the MD5 message-digest algorithm. 00003 * The algorithm is due to Ron Rivest. This code was 00004 * written by Colin Plumb in 1993, no copyright is claimed. 00005 * This code is in the public domain; do with it what you wish. 00006 * 00007 * Equivalent code is available from RSA Data Security, Inc. 00008 * This code has been tested against that, and is equivalent, 00009 * except that you don't need to include two pages of legalese 00010 * with every copy. 00011 * 00012 * To compute the message digest of a chunk of bytes, declare an 00013 * MD5Context structure, pass it to MD5Init, call MD5Update as 00014 * needed on buffers full of bytes, and then call MD5Final, which 00015 * will fill a supplied 16-byte array with the digest. 00016 */ 00017 00018 /* This code slightly modified to fit into Samba by 00019 abartlet@samba.org Jun 2001 */ 00020 00021 #ifndef MD5_H 00022 #define MD5_H 00023 #ifndef HEADER_MD5_H 00024 /* Try to avoid clashes with OpenSSL */ 00025 #define HEADER_MD5_H 00026 #endif 00027 00028 /* 00029 * Note we duplicate the size tests in the unsigned 00030 * case as int32 may be a typedef from rpc/rpc.h 00031 */ 00032 00033 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H) 00034 #if (SIZEOF_INT == 4) 00035 #define uint32 unsigned int 00036 #elif (SIZEOF_LONG == 4) 00037 #define uint32 unsigned long 00038 #elif (SIZEOF_SHORT == 4) 00039 #define uint32 unsigned short 00040 #else 00041 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */ 00042 #define uint32 unsigned 00043 #endif 00044 #endif 00045 00046 struct MD5Context { 00047 uint32 buf[4]; 00048 uint32 bits[2]; 00049 unsigned char in[64]; 00050 }; 00051 00052 void MD5Init(struct MD5Context *context); 00053 void MD5Update(struct MD5Context *context, unsigned char const *buf, 00054 unsigned len); 00055 void MD5Final(unsigned char digest[16], struct MD5Context *context); 00056 00057 #endif /* !MD5_H */