/* * category: [algorithm] * apply status: * edit status: * build status: * description: */ #ifndef __MD5_H__ #define __MD5_H__ #pragma once #include "config.h" #ifdef __cplusplus extern "C" { #endif #include #include #define MD5_DIGESTSIZE 16 typedef struct md5_ctx_t md5_ctx_t; /** MD5 context. */ struct md5_ctx_t { /** state (ABCD) */ uint32_t state[4]; /** number of bits, modulo 2^64 (lsb first) */ uint32_t count[2]; /** input buffer */ unsigned char buffer[64]; }; TOOLKIT_API int md5_init(md5_ctx_t *context); /** * MD5 block update operation. Continue an MD5 message-digest operation, * processing another message block, and updating the context. * @param context The MD5 content to update. * @param input next message block to update * @param inputLen The length of the next message block */ TOOLKIT_API int md5_update(md5_ctx_t *context,const void *input,size_t inputLen); /** * MD5 finalization. Ends an MD5 message-digest operation, writing the * message digest and zeroing the context * @param digest The final MD5 digest * @param context The MD5 content we are finalizing. */ TOOLKIT_API int md5_final(unsigned char digest[MD5_DIGESTSIZE],md5_ctx_t *context); /** * MD5 in one step * @param digest The final MD5 digest * @param input The message block to use * @param inputLen The length of the message block */ TOOLKIT_API int md5(unsigned char digest[MD5_DIGESTSIZE],const void *input,size_t inputLen); #ifdef __cplusplus } // extern "C" { #endif #endif // __MD5_H__