/******************************************************************************************* * describe: MD5ʵ�� * author: liuyong * date: 20180828 *******************************************************************************************/ #ifndef __UTL_SHA256_H__ #define __UTL_SHA256_H__ #include #ifdef __cplusplus #if __cplusplus extern "C"{ #endif #endif /* End of #ifdef __cplusplus */ /*************************** HEADER FILES ***************************/ #include /****************************** MACROS ******************************/ #define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest /**************************** DATA TYPES ****************************/ typedef struct { unsigned char data[64]; // current 512-bit chunk of message data, just like a buffer unsigned int datalen; // sign the data length of current chunk unsigned long long bitlen; // the bit length of the total message unsigned int state[8]; // store the middle state of hash abstract } SHA256_CTX; /*********************** FUNCTION DECLARATIONS **********************/ void sha256_init(SHA256_CTX *ctx); void sha256_update(SHA256_CTX *ctx, const unsigned char data[], size_t len); void sha256_final(SHA256_CTX *ctx, unsigned char hash[]); #ifdef __cplusplus #if __cplusplus } #endif #endif /* End of #ifdef __cplusplus */ #endif /* End of #ifndef __M_MD5_H__ */