comparison src/pop3_in.c @ 162:52c82d755215

replaced the MD5 implementation with the one of Solar Designer Until now, the sample code of RFC 1321 was used. It had an ugly license. Now we use the implementation of Solar Designer, which is in the Public Domain. http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
author meillo@marmaro.de
date Sun, 18 Jul 2010 22:01:04 +0200
parents 2685e59f6f43
children
comparison
equal deleted inserted replaced
161:6655f7708ee1 162:52c82d755215
25 #include "readsock.h" 25 #include "readsock.h"
26 26
27 #ifdef USE_LIB_CRYPTO 27 #ifdef USE_LIB_CRYPTO
28 #include <openssl/md5.h> 28 #include <openssl/md5.h>
29 #else 29 #else
30 #include "md5/global.h"
31 #include "md5/md5.h" 30 #include "md5/md5.h"
32 #endif 31 #endif
33 32
34 #ifdef ENABLE_POP3 33 #ifdef ENABLE_POP3
35 34
45 int i; 44 int i;
46 45
47 #ifdef USE_LIB_CRYPTO 46 #ifdef USE_LIB_CRYPTO
48 MD5(string, strlen(string), digest); 47 MD5(string, strlen(string), digest);
49 #else 48 #else
50 MD5Init(&context); 49 MD5_Init(&context);
51 MD5Update(&context, string, strlen(string)); 50 MD5_Update(&context, string, strlen(string));
52 MD5Final(digest, &context); 51 MD5_Final(digest, &context);
53 #endif 52 #endif
54 for (i = 0; i < 16; i++) 53 for (i = 0; i < 16; i++)
55 sprintf(str_digest + 2 * i, "%02x", digest[i]); 54 sprintf(str_digest + 2 * i, "%02x", digest[i]);
56 55
57 return g_strdup(str_digest); 56 return g_strdup(str_digest);