#ifndef SHA512_H
#define SHA512_H
#ifdef __cplusplus
extern "C" {
#endif
// standard C includes
#include <stdint.h>
// SHA-512 block and digest sizes
#define SHA512_BLOCK_LENGTH 128 // in bytes
#define SHA512_DIGEST_LENGTH 64 // in bytes
// SHA-512 computation context structure type definition
typedef struct sha512_ctx_s
{
uint64_t state[8];
uint64_t bitcount[2];
uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
// prototypes of exported functions
void SHA512_Init (SHA512_CTX *context);
void SHA512_Update (SHA512_CTX *context, void *data, size_t len);
void SHA512_Final (uint8_t digest[SHA512_DIGEST_LENGTH], SHA512_CTX *context);
uint8_t *SHA512 (void *data, size_t data_len, uint8_t *digest); // computes a SHA-512 in one pass (shortcut for SHA512_Init(), SHA512_Update() N times and SHA512_Final())
#ifdef __cplusplus
}
#endif
#endif // SHA512_H