需要SHA256算法支持!详情请点击 Linux C sha256算法实现
/*
* hmac_sha256.h
*/
#include "sha256.h"
#define HMAC_SHA256_DIGEST_LENGTH 32
#define HMAC_SHA256_BLOCK_LENGTH 64
typedef struct _HMAC_SHA256_CTX {
unsigned char ipad[HMAC_SHA256_BLOCK_LENGTH];
unsigned char opad[HMAC_SHA256_BLOCK_LENGTH];
SHA256_CTX shactx;
unsigned char key[HMAC_SHA256_BLOCK_LENGTH];
unsigned int keylen;
unsigned int hashkey;
} HMAC_SHA256_CTX;
void HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx);
void HMAC_SHA256_UpdateKey(HMAC_SHA256_CTX *ctx, const unsigned char *key, unsigned int keylen);
void HMAC_SHA256_EndKey(HMAC_SHA256_CTX *ctx);
void HMAC_SHA256_StartMessage(HMAC_SHA256_CTX *ctx);
void HMAC_SHA256_UpdateMessage(HMAC_SHA256_CTX *ctx, const unsigned char *data, unsigned int datalen);
void HMAC_SHA256_EndMessage(unsigned char *out, HMAC_SHA256_CTX *ctx