mirror of
https://github.com/stasenso/sha256_c_client.git
synced 2026-06-26 21:32:42 +03:00
49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
#ifndef SHA256_SHA_H
|
|
#define SHA256_SHA_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef _WIN32
|
|
#ifdef SHA256_EXPORTS
|
|
#define SHA256_API __declspec(dllexport)
|
|
#else
|
|
#define SHA256_API __declspec(dllimport)
|
|
#endif
|
|
#else
|
|
#define SHA256_API
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef uint32_t sha256_digest_t[8];
|
|
|
|
SHA256_API int TestHello(void);
|
|
|
|
/*
|
|
* Returns NULL (0) on success according to assembly comments.
|
|
* data_addr - pointer to current data chunk.
|
|
* full_size - total message/file size in bytes.
|
|
* current_size - current chunk size in bytes.
|
|
* digest - 32-byte state/result buffer (8 x uint32_t).
|
|
* is_last_chunk - 1 if this is the last chunk, otherwise 0.
|
|
*/
|
|
SHA256_API void *Sha256(
|
|
const void *data_addr,
|
|
uint64_t full_size,
|
|
uint64_t current_size,
|
|
sha256_digest_t digest,
|
|
uint64_t is_last_chunk
|
|
);
|
|
|
|
/* Initializes digest and internal K constants. */
|
|
SHA256_API void Sha256Init(sha256_digest_t digest);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SHA256_SHA_H */
|