X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2FMD5.c;h=f8dc3fea3371b5d12729233b0f0cdd28dd979951;hb=d51c9b672a2a23d9e9c7bc4c2d366ca8d66bda0e;hp=c12b7615ec5d3f2a0ed744e833d8ca609ed40a51;hpb=6c3ab5574d31504d24710c2756899d49275c1a37;p=swftools.git diff --git a/lib/MD5.c b/lib/MD5.c index c12b761..f8dc3fe 100644 --- a/lib/MD5.c +++ b/lib/MD5.c @@ -33,6 +33,7 @@ #include "../config.h" #include +#include #ifndef _NETINET6_MD5_H_ #define _NETINET6_MD5_H_ @@ -175,6 +176,24 @@ void hash_md5(const unsigned char*buf, int len, unsigned char*dest) MD5Final(dest, &ctx); } +void* inititialize_md5() +{ + MD5_CTX* ctx = malloc(sizeof(MD5_CTX)); + memset(ctx, 0, sizeof(MD5_CTX)); + MD5Init(ctx); + return ctx; +} +void update_md5(void*ctx, unsigned char*data, int len) +{ + MD5Update(ctx, data, len); +} +void finish_md5(void*ctx, unsigned char*dest) +{ + MD5Final(dest, ctx); + free(ctx); +} + + char * crypt_md5(const char *pw, const char *salt) { MD5_CTX ctx,ctx1;