php_hash_sha3.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Sara Golemon <pollita@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_HASH_SHA3_H
  19. #define PHP_HASH_SHA3_H
  20. #include "php.h"
  21. typedef struct {
  22. #ifdef HAVE_SLOW_HASH3
  23. unsigned char state[200]; // 5 * 5 * sizeof(uint64)
  24. uint32_t pos;
  25. #else
  26. void *hashinstance;
  27. #endif
  28. } PHP_SHA3_CTX;
  29. typedef PHP_SHA3_CTX PHP_SHA3_224_CTX;
  30. typedef PHP_SHA3_CTX PHP_SHA3_256_CTX;
  31. typedef PHP_SHA3_CTX PHP_SHA3_384_CTX;
  32. typedef PHP_SHA3_CTX PHP_SHA3_512_CTX;
  33. PHP_HASH_API void PHP_SHA3224Init(PHP_SHA3_224_CTX*);
  34. PHP_HASH_API void PHP_SHA3224Update(PHP_SHA3_224_CTX*, const unsigned char*, unsigned int);
  35. PHP_HASH_API void PHP_SAH3224Final(unsigned char[32], PHP_SHA3_224_CTX*);
  36. PHP_HASH_API void PHP_SHA3256Init(PHP_SHA3_256_CTX*);
  37. PHP_HASH_API void PHP_SHA3256Update(PHP_SHA3_256_CTX*, const unsigned char*, unsigned int);
  38. PHP_HASH_API void PHP_SAH3256Final(unsigned char[32], PHP_SHA3_256_CTX*);
  39. PHP_HASH_API void PHP_SHA3384Init(PHP_SHA3_384_CTX*);
  40. PHP_HASH_API void PHP_SHA3384Update(PHP_SHA3_384_CTX*, const unsigned char*, unsigned int);
  41. PHP_HASH_API void PHP_SAH3384Final(unsigned char[32], PHP_SHA3_384_CTX*);
  42. PHP_HASH_API void PHP_SHA3512Init(PHP_SHA3_512_CTX*);
  43. PHP_HASH_API void PHP_SHA3512Update(PHP_SHA3_512_CTX*, const unsigned char*, unsigned int);
  44. PHP_HASH_API void PHP_SAH3512Final(unsigned char[32], PHP_SHA3_512_CTX*);
  45. #endif
  46. /*
  47. * Local variables:
  48. * tab-width: 4
  49. * c-basic-offset: 4
  50. * End:
  51. * vim600: sw=4 ts=4 fdm=marker
  52. * vim<600: sw=4 ts=4
  53. */