Logo Search packages:      
Sourcecode: dbmail version File versions  Download package

dbmd5.c

/* $Id: dbmd5.c,v 1.10 2003/03/17 16:04:08 roel Exp $ 
 * (c) 2000-2002 IC&S, The Netherlands
 *
 * Functions to create md5 hash from buf */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "dbmd5.h"
#include "md5.h"
#include "debug.h"

unsigned char *makemd5(char *buf)
{
      struct GdmMD5Context mycontext;
      unsigned char result[16];
      unsigned char *md5hash;
      int i;
      
      md5hash=(unsigned char *)my_malloc(33);
      
      gdm_md5_init (&mycontext);
      gdm_md5_update (&mycontext,buf,strlen(buf));
      gdm_md5_final (result,&mycontext);
      
      for (i = 0; i < 16; i++) {
          sprintf (&md5hash[i*2],"%02x", result[i]);
      }

      return md5hash;
}

Generated by  Doxygen 1.6.0   Back to index