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.

65 lines
1007 B

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #include "precomp.h"
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <memory.h>
  11. #include "md5.h"
  12. #include "md5wbem.h"
  13. void MD5::Transform(
  14. IN LPVOID pInputValue,
  15. IN UINT uValueLength,
  16. OUT BYTE MD5Buffer[16]
  17. )
  18. {
  19. MD5_CTX Ctx;
  20. MD5Init(&Ctx);
  21. MD5Update(
  22. &Ctx,
  23. (unsigned char *) pInputValue,
  24. uValueLength
  25. );
  26. MD5Final(&Ctx);
  27. CopyMemory(MD5Buffer, Ctx.digest, 16);
  28. }
  29. void MD5::ContinueTransform(
  30. IN LPVOID pInputValue,
  31. IN UINT uValueLength,
  32. IN OUT BYTE MD5Buffer[16]
  33. )
  34. {
  35. MD5_CTX Ctx;
  36. MD5Init(&Ctx); // zeros buffer, and counts
  37. CopyMemory( Ctx.buf, MD5Buffer, 16 );
  38. MD5Update(
  39. &Ctx,
  40. (unsigned char *) pInputValue,
  41. uValueLength
  42. );
  43. MD5Final(&Ctx);
  44. CopyMemory(MD5Buffer, Ctx.digest, 16);
  45. }