md5.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. **********************************************************************
  3. ** MD5.h **
  4. ** **
  5. ** - Style modified by Tony Ray, January 2001 **
  6. ** Added support for randomizing initialization constants **
  7. ** - Style modified by Dominik Reichl, September 2002 **
  8. ** Optimized code **
  9. ** **
  10. **********************************************************************
  11. */
  12. /*
  13. **********************************************************************
  14. ** MD5.h -- Header file for implementation of MD5 **
  15. ** RSA Data Security, Inc. MD5 Message Digest Algorithm **
  16. ** Created: 2/17/90 RLR **
  17. ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
  18. ** Revised (for MD5): RLR 4/27/91 **
  19. ** -- G modified to have y&~z instead of y&z **
  20. ** -- FF, GG, HH modified to add in last register done **
  21. ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
  22. ** -- distinct additive constant for each step **
  23. ** -- round 4 added, working mod 7 **
  24. **********************************************************************
  25. */
  26. /*
  27. **********************************************************************
  28. ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
  29. ** **
  30. ** License to copy and use this software is granted provided that **
  31. ** it is identified as the "RSA Data Security, Inc. MD5 Message **
  32. ** Digest Algorithm" in all material mentioning or referencing this **
  33. ** software or this function. **
  34. ** **
  35. ** License is also granted to make and use derivative works **
  36. ** provided that such works are identified as "derived from the RSA **
  37. ** Data Security, Inc. MD5 Message Digest Algorithm" in all **
  38. ** material mentioning or referencing the derived work. **
  39. ** **
  40. ** RSA Data Security, Inc. makes no representations concerning **
  41. ** either the merchantability of this software or the suitability **
  42. ** of this software for any particular purpose. It is provided "as **
  43. ** is" without express or implied warranty of any kind. **
  44. ** **
  45. ** These notices must be retained in any copies of any part of this **
  46. ** documentation and/or software. **
  47. **********************************************************************
  48. */
  49. #ifndef ___MD5_H___
  50. #define ___MD5_H___
  51. /* Typedef a 32 bit type */
  52. #ifndef UINT4
  53. typedef unsigned long int UINT4;
  54. #endif
  55. /* Data structure for MD5 (Message Digest) computation */
  56. typedef struct {
  57. UINT4 i[2]; /* Number of _bits_ handled mod 2^64 */
  58. UINT4 buf[4]; /* Scratch buffer */
  59. unsigned char in[64]; /* Input buffer */
  60. unsigned char digest[16]; /* Actual digest after MD5Final call */
  61. } MD5_CTX;
  62. static void MD5_Transform (UINT4 *buf, UINT4 *in);
  63. void MD5Init(MD5_CTX *mdContext, unsigned long pseudoRandomNumber = 0);
  64. void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen);
  65. void MD5Final(MD5_CTX *mdContext);
  66. #endif /* ___MD5_H___ included */