Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / md5.h
1 /*
2  * ** **************************************************************************
3  * ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm **
4  * ** Updated: 2/13/90 by Ronald L. Rivest                                    **
5  * ** (C) 1990 RSA Data Security, Inc.                                        **
6  * ** **************************************************************************
7  */
8
9 #ifndef MD5_H
10 #define MD5_H
11
12 #ifdef __cplusplus
13 extern          "C" {
14 #endif
15
16
17     /*
18      * MDstruct is the data structure for a message digest computation.
19      */
20     typedef struct {
21         unsigned int    buffer[4];      /* Holds 4-word result of MD computation */
22         unsigned char   count[8];       /* Number of bits processed so far */
23         unsigned int    done;   /* Nonzero means MD computation finished */
24     } MDstruct     , *MDptr;
25
26     /*
27      * MDbegin(MD)
28      * ** Input: MD -- an MDptr
29      * ** Initialize the MDstruct prepatory to doing a message digest computation.
30      */
31     extern void     MDbegin(MDptr);
32
33     /*
34      * MDupdate(MD,X,count)
35      * ** Input: MD -- an MDptr
36      * **        X -- a pointer to an array of unsigned characters.
37      * **        count -- the number of bits of X to use (an unsigned int).
38      * ** Updates MD using the first ``count'' bits of X.
39      * ** The array pointed to by X is not modified.
40      * ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
41      * ** This is the basic input routine for a user.
42      * ** The routine terminates the MD computation when count < 512, so
43      * ** every MD computation should end with one call to MDupdate with a
44      * ** count less than 512.  Zero is OK for a count.
45      */
46     extern int      MDupdate(MDptr, unsigned char *, unsigned int);
47
48     /*
49      * MDprint(MD)
50      * ** Input: MD -- an MDptr
51      * ** Prints message digest buffer MD as 32 hexadecimal digits.
52      * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
53      * ** Each byte is printed with high-order hexadecimal digit first.
54      */
55     extern void     MDprint(MDptr);
56
57     int             MDchecksum(u_char * data, size_t len, u_char * mac,
58                                size_t maclen);
59     int             MDsign(u_char * data, size_t len, u_char * mac,
60                            size_t maclen, u_char * secret,
61                            size_t secretlen);
62     void            MDget(MDstruct * MD, u_char * buf, size_t buflen);
63
64     /*
65      * ** End of md5.h
66      * ****************************(cut)****************************************
67      */
68 #ifdef __cplusplus
69 }
70 #endif
71 #endif                          /* MD5_H */