php_hash_md.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Original Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
  14. | Modified for pHASH by: Sara Golemon <pollita@php.net>
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef PHP_HASH_MD_H
  18. #define PHP_HASH_MD_H
  19. #include "ext/standard/md5.h"
  20. /* MD4 context */
  21. typedef struct {
  22. uint32_t state[4];
  23. uint32_t count[2];
  24. unsigned char buffer[64];
  25. } PHP_MD4_CTX;
  26. #define PHP_MD4_SPEC "l4l2b64."
  27. #define PHP_MD4Init(ctx) PHP_MD4InitArgs(ctx, NULL)
  28. PHP_HASH_API void PHP_MD4InitArgs(PHP_MD4_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
  29. PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, size_t);
  30. PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
  31. /* MD2 context */
  32. typedef struct {
  33. unsigned char state[48];
  34. unsigned char checksum[16];
  35. unsigned char buffer[16];
  36. unsigned char in_buffer;
  37. } PHP_MD2_CTX;
  38. #define PHP_MD2_SPEC "b48b16b16b."
  39. #define PHP_MD2Init(ctx) PHP_MD2InitArgs(ctx, NULL)
  40. PHP_HASH_API void PHP_MD2InitArgs(PHP_MD2_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
  41. PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *, size_t);
  42. PHP_HASH_API void PHP_MD2Final(unsigned char[16], PHP_MD2_CTX *);
  43. #endif