Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
4.1 KiB

  1. /*
  2. ***********************************************************************
  3. ** md5.h -- Header file for implementation of MD5 **
  4. ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
  5. ** Created: 2/17/90 RLR **
  6. ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
  7. ** Revised (for MD5): RLR 4/27/91 **
  8. ** -- G modified to have y&~z instead of y&z **
  9. ** -- FF, GG, HH modified to add in last register done **
  10. ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
  11. ** -- distinct additive constant for each step **
  12. ** -- round 4 added, working mod 7 **
  13. ***********************************************************************
  14. */
  15. /*
  16. ***********************************************************************
  17. ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
  18. ** **
  19. ** License to copy and use this software is granted provided that **
  20. ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
  21. ** Digest Algorithm" in all material mentioning or referencing this **
  22. ** software or this function. **
  23. ** **
  24. ** License is also granted to make and use derivative works **
  25. ** provided that such works are identified as "derived from the RSA **
  26. ** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
  27. ** material mentioning or referencing the derived work. **
  28. ** **
  29. ** RSA Data Security, Inc. makes no representations concerning **
  30. ** either the merchantability of this software or the suitability **
  31. ** of this software for any particular purpose. It is provided "as **
  32. ** is" without express or implied warranty of any kind. **
  33. ** **
  34. ** These notices must be retained in any copies of any part of this **
  35. ** documentation and/or software. **
  36. ***********************************************************************
  37. */
  38. /* */
  39. /* This copy of md5.h modified and adapted for my purposes, tommcg 6/28/96 */
  40. /* */
  41. #pragma warning( disable: 4201 4204 )
  42. #ifndef VOID
  43. typedef void VOID;
  44. #endif
  45. #ifndef UCHAR
  46. typedef unsigned char UCHAR;
  47. #endif
  48. #ifndef ULONG
  49. typedef unsigned long ULONG;
  50. #endif
  51. #ifndef ULONGLONG
  52. typedef unsigned __int64 ULONGLONG;
  53. #endif
  54. #ifndef PCVOID
  55. typedef const void * PCVOID;
  56. #endif
  57. #ifndef IN
  58. #define IN
  59. #endif
  60. #ifndef OUT
  61. #define OUT
  62. #endif
  63. typedef struct _MD5_HASH MD5_HASH, *PMD5_HASH;
  64. struct _MD5_HASH {
  65. union {
  66. ULONG Word32[ 4 ];
  67. UCHAR Byte [ 16 ];
  68. };
  69. };
  70. #define MD5_INITIAL_VALUE { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }
  71. VOID
  72. InitMD5(
  73. IN OUT PMD5_HASH HashValue
  74. );
  75. VOID
  76. UpdateMD5_64ByteChunk(
  77. IN OUT PMD5_HASH HashValue, // existing hash value
  78. IN PCVOID DataChunk // pointer to 64 bytes of data
  79. );
  80. VOID
  81. FinalizeMD5(
  82. IN OUT PMD5_HASH HashValue, // existing hash value
  83. IN PCVOID RemainingData, // remaining data to hash
  84. IN ULONG RemainingBytes, // 0 <= RemainingBytes < 64
  85. IN ULONGLONG TotalBytesHashed // total bytes hashed
  86. );
  87. VOID
  88. ComputeCompleteMD5( // complete MD5 in one call
  89. IN PCVOID DataBuffer, // buffer to compute MD5 over
  90. IN ULONGLONG DataLength, // bytes of data in buffer
  91. OUT PMD5_HASH HashValue // return finalized MD5 value
  92. );