net-snmp 5.7
md5.h
00001 /*
00002  * ** **************************************************************************
00003  * ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm **
00004  * ** Updated: 2/13/90 by Ronald L. Rivest                                    **
00005  * ** (C) 1990 RSA Data Security, Inc.                                        **
00006  * ** **************************************************************************
00007  */
00008 
00009 #ifndef MD5_H
00010 #define MD5_H
00011 
00012 #ifdef __cplusplus
00013 extern          "C" {
00014 #endif
00015 
00016 
00017     /*
00018      * MDstruct is the data structure for a message digest computation.
00019      */
00020     typedef struct {
00021         unsigned int    buffer[4];      /* Holds 4-word result of MD computation */
00022         unsigned char   count[8];       /* Number of bits processed so far */
00023         unsigned int    done;   /* Nonzero means MD computation finished */
00024     } MDstruct     , *MDptr;
00025 
00026     /*
00027      * MDbegin(MD)
00028      * ** Input: MD -- an MDptr
00029      * ** Initialize the MDstruct prepatory to doing a message digest computation.
00030      */
00031     NETSNMP_IMPORT void MDbegin(MDptr);
00032 
00033     /*
00034      * MDupdate(MD,X,count)
00035      * ** Input: MD -- an MDptr
00036      * **        X -- a pointer to an array of unsigned characters.
00037      * **        count -- the number of bits of X to use (an unsigned int).
00038      * ** Updates MD using the first ``count'' bits of X.
00039      * ** The array pointed to by X is not modified.
00040      * ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
00041      * ** This is the basic input routine for a user.
00042      * ** The routine terminates the MD computation when count < 512, so
00043      * ** every MD computation should end with one call to MDupdate with a
00044      * ** count less than 512.  Zero is OK for a count.
00045      */
00046     NETSNMP_IMPORT int MDupdate(MDptr, const unsigned char *, unsigned int);
00047 
00048     /*
00049      * MDprint(MD)
00050      * ** Input: MD -- an MDptr
00051      * ** Prints message digest buffer MD as 32 hexadecimal digits.
00052      * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
00053      * ** Each byte is printed with high-order hexadecimal digit first.
00054      */
00055     extern void     MDprint(MDptr);
00056 
00057     int             MDchecksum(const u_char * data, size_t len, u_char * mac,
00058                                size_t maclen);
00059     int             MDsign(const u_char * data, size_t len, u_char * mac,
00060                            size_t maclen, const u_char * secret,
00061                            size_t secretlen);
00062     void            MDget(MDstruct * MD, u_char * buf, size_t buflen);
00063 
00064     /*
00065      * ** End of md5.h
00066      * ****************************(cut)****************************************
00067      */
00068 #ifdef __cplusplus
00069 }
00070 #endif
00071 #endif                          /* MD5_H */