00001
00002
00003
00004
00005
00006
00007 #ifndef MD5_H
00008 #define MD5_H
00009
00010 #include <stdint.h>
00011 #include <stdlib.h>
00012
00017 #define MD5_DIGEST_LENGTH 16
00018 #define MD5_DIGEST_LENGTH_HEX (MD5_DIGEST_LENGTH<<1)
00019
00020 typedef struct {
00021 uint32_t state[4];
00022 uint32_t count[2];
00023 uint8_t buffer[64];
00024 } md5_context_t;
00025
00026 void md5_init(md5_context_t * ctx);
00027 void md5_update(md5_context_t * ctx, const void *, size_t);
00028 void md5_final(unsigned char digest[MD5_DIGEST_LENGTH], md5_context_t * ctx);
00029
00038 void md5_buffer(const void *buffer, size_t length, unsigned char digest[MD5_DIGEST_LENGTH]);
00039
00048 int md5_file(const char *filename, unsigned char digest[MD5_DIGEST_LENGTH]);
00049
00055 const char *md5_string(unsigned char digest[MD5_DIGEST_LENGTH]);
00056
00057 #endif