+void hash_md5(const unsigned char*buf, int len, unsigned char*dest)
+{
+ u_char final[MD5_SIZE];
+
+ MD5_CTX ctx;
+ MD5Init(&ctx);
+ MD5Update(&ctx, buf, len);
+ MD5Final(dest, &ctx);
+}
+
+void* init_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);
+}
+
+