mongoose/src/sha256.h
2023-12-20 11:04:31 +00:00

17 lines
448 B
C

#pragma once
#include "arch.h"
typedef struct {
uint32_t state[8];
uint64_t bits;
uint32_t len;
unsigned char buffer[64];
} mg_sha256_ctx;
void mg_sha256_init(mg_sha256_ctx *);
void mg_sha256_update(mg_sha256_ctx *, const unsigned char *data, size_t len);
void mg_sha256_final(unsigned char digest[32], mg_sha256_ctx *);
void mg_hmac_sha256(uint8_t dst[32], uint8_t *key, size_t keysz, uint8_t *data,
size_t datasz);