sha3.h 543 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. #include "compiler.h"
  6. #include <stdint.h>
  7. #include <stdlib.h>
  8. struct ethash_h256;
  9. #define decsha3(bits) \
  10. int sha3_##bits(uint8_t*, size_t, uint8_t const*, size_t);
  11. decsha3(256)
  12. decsha3(512)
  13. static inline void SHA3_256(struct ethash_h256 const* ret, uint8_t const* data, size_t const size)
  14. {
  15. sha3_256((uint8_t*)ret, 32, data, size);
  16. }
  17. static inline void SHA3_512(uint8_t* ret, uint8_t const* data, size_t const size)
  18. {
  19. sha3_512(ret, 64, data, size);
  20. }
  21. #ifdef __cplusplus
  22. }
  23. #endif