md5.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef MD5_H
  9. #define MD5_H
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /*
  14. * MDstruct is the data structure for a message digest computation.
  15. */
  16. typedef struct {
  17. unsigned int buffer[4]; /* Holds 4-word result of MD computation */
  18. unsigned char count[8]; /* Number of bits processed so far */
  19. unsigned int done; /* Nonzero means MD computation finished */
  20. } MDstruct , *MDptr;
  21. /*
  22. * MDbegin(MD)
  23. * ** Input: MD -- an MDptr
  24. * ** Initialize the MDstruct prepatory to doing a message digest computation.
  25. */
  26. NETSNMP_IMPORT void MDbegin(MDptr);
  27. /*
  28. * MDupdate(MD,X,count)
  29. * ** Input: MD -- an MDptr
  30. * ** X -- a pointer to an array of unsigned characters.
  31. * ** count -- the number of bits of X to use (an unsigned int).
  32. * ** Updates MD using the first ``count'' bits of X.
  33. * ** The array pointed to by X is not modified.
  34. * ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
  35. * ** This is the basic input routine for a user.
  36. * ** The routine terminates the MD computation when count < 512, so
  37. * ** every MD computation should end with one call to MDupdate with a
  38. * ** count less than 512. Zero is OK for a count.
  39. */
  40. NETSNMP_IMPORT int MDupdate(MDptr, const unsigned char *, unsigned int);
  41. /*
  42. * MDprint(MD)
  43. * ** Input: MD -- an MDptr
  44. * ** Prints message digest buffer MD as 32 hexadecimal digits.
  45. * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
  46. * ** Each byte is printed with high-order hexadecimal digit first.
  47. */
  48. extern void MDprint(MDptr);
  49. int MDchecksum(const u_char * data, size_t len, u_char * mac,
  50. size_t maclen);
  51. int MDsign(const u_char * data, size_t len, u_char * mac,
  52. size_t maclen, const u_char * secret,
  53. size_t secretlen);
  54. void MDget(MDstruct * MD, u_char * buf, size_t buflen);
  55. /*
  56. * ** End of md5.h
  57. * ****************************(cut)****************************************
  58. */
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif /* MD5_H */