sha512.h 874 B

1234567891011121314151617181920212223242526272829303132
  1. /* sha.h sha512 and sha384 hash functions */
  2. #ifndef SHA512_H
  3. #define SHA512_H
  4. #include "ustd.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define sha512_block_size 128
  9. #define sha512_hash_size 64
  10. #define sha384_hash_size 48
  11. /* algorithm context */
  12. typedef struct sha512_ctx
  13. {
  14. uint64_t message[16]; /* 1024-bit buffer for leftovers */
  15. uint64_t length; /* number of processed bytes */
  16. uint64_t hash[8]; /* 512-bit algorithm internal hashing state */
  17. unsigned digest_length; /* length of the algorithm digest in bytes */
  18. } sha512_ctx;
  19. void rhash_sha384_init(sha512_ctx *ctx);
  20. void rhash_sha512_init(sha512_ctx *ctx);
  21. void rhash_sha512_update(sha512_ctx *ctx, const unsigned char* data, size_t length);
  22. void rhash_sha512_final(sha512_ctx *ctx, unsigned char* result);
  23. #ifdef __cplusplus
  24. } /* extern "C" */
  25. #endif /* __cplusplus */
  26. #endif /* SHA512_H */