#ifndef GL_SHA256_H_ #define GL_SHA256_H_ #include #include #define GL_SHA256_DIGEST_SIZE 32 #define GL_SHA256_HEX_SIZE (GL_SHA256_DIGEST_SIZE * 2 + 1) typedef struct { uint32_t state[8]; uint64_t bitlen; uint8_t data[64]; size_t datalen; } gl_sha256_ctx_t; void gl_sha256_init(gl_sha256_ctx_t *ctx); void gl_sha256_update(gl_sha256_ctx_t *ctx, const uint8_t *data, size_t len); void gl_sha256_final(gl_sha256_ctx_t *ctx, uint8_t digest[GL_SHA256_DIGEST_SIZE]); void gl_sha256_to_hex(const uint8_t digest[GL_SHA256_DIGEST_SIZE], char *out); int gl_sha256_file(const char *path, char *hex_out); #endif