00001
00002
00003
00004
00005
00006
00007 #ifndef MD5_H
00008 #define MD5_H
00009
00010 #include <stdint.h>
00011 #include <stdlib.h>
00012
00013 #define md5_init cctools_md5_init
00014 #define md5_update cctools_md5_update
00015 #define md5_final cctools_md5_final
00016 #define md5_buffer cctools_md5_buffer
00017 #define md5_file cctools_md5_file
00018 #define md5_string cctools_md5_string
00019
00024 #define MD5_DIGEST_LENGTH 16
00025 #define MD5_DIGEST_LENGTH_HEX (MD5_DIGEST_LENGTH<<1)
00026
00027 typedef struct {
00028 uint32_t state[4];
00029 uint32_t count[2];
00030 uint8_t buffer[64];
00031 } md5_context_t;
00032
00033 void md5_init(md5_context_t * ctx);
00034 void md5_update(md5_context_t * ctx, const void *, size_t);
00035 void md5_final(unsigned char digest[MD5_DIGEST_LENGTH], md5_context_t * ctx);
00036
00045 void md5_buffer(const void *buffer, size_t length, unsigned char digest[MD5_DIGEST_LENGTH]);
00046
00055 int md5_file(const char *filename, unsigned char digest[MD5_DIGEST_LENGTH]);
00056
00062 const char *md5_string(unsigned char digest[MD5_DIGEST_LENGTH]);
00063
00064 #endif