php_hash_haval.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. | Author: Sara Golemon <pollita@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_HASH_HAVAL_H
  17. #define PHP_HASH_HAVAL_H
  18. #include "ext/standard/basic_functions.h"
  19. /* HAVAL context. */
  20. typedef struct {
  21. uint32_t state[8];
  22. uint32_t count[2];
  23. unsigned char buffer[128];
  24. char passes;
  25. short output;
  26. void (*Transform)(uint32_t state[8], const unsigned char block[128]);
  27. } PHP_HAVAL_CTX;
  28. #define PHP_HAVAL_SPEC "l8l2b128"
  29. #define PHP_HASH_HAVAL_INIT_DECL(p,b) PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); \
  30. PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
  31. PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, size_t);
  32. PHP_HASH_HAVAL_INIT_DECL(3,128)
  33. PHP_HASH_HAVAL_INIT_DECL(3,160)
  34. PHP_HASH_HAVAL_INIT_DECL(3,192)
  35. PHP_HASH_HAVAL_INIT_DECL(3,224)
  36. PHP_HASH_HAVAL_INIT_DECL(3,256)
  37. PHP_HASH_HAVAL_INIT_DECL(4,128)
  38. PHP_HASH_HAVAL_INIT_DECL(4,160)
  39. PHP_HASH_HAVAL_INIT_DECL(4,192)
  40. PHP_HASH_HAVAL_INIT_DECL(4,224)
  41. PHP_HASH_HAVAL_INIT_DECL(4,256)
  42. PHP_HASH_HAVAL_INIT_DECL(5,128)
  43. PHP_HASH_HAVAL_INIT_DECL(5,160)
  44. PHP_HASH_HAVAL_INIT_DECL(5,192)
  45. PHP_HASH_HAVAL_INIT_DECL(5,224)
  46. PHP_HASH_HAVAL_INIT_DECL(5,256)
  47. #endif