[ActiveLock-Development] CVS: alcrypto MD5.C,1.3,1.4
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-07-31 06:16:56
|
Update of /cvsroot/activelock/alcrypto In directory sc8-pr-cvs1:/tmp/cvs-serv5188 Modified Files: MD5.C Log Message: Added len parameter to md5_hash() function - cannot rely on strlen(). Index: MD5.C =================================================================== RCS file: /cvsroot/activelock/alcrypto/MD5.C,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MD5.C 31 Jul 2003 05:37:58 -0000 1.3 +++ MD5.C 31 Jul 2003 06:16:54 -0000 1.4 @@ -359,14 +359,14 @@ /** * API function to compute MD5 hash. */ -ALCRYPTO_API LRESULT WINAPI md5_hash(unsigned char *in, unsigned char *out) +ALCRYPTO_API LRESULT WINAPI md5_hash(unsigned char *in, int len, unsigned char *out) { static const char hex[] = "0123456789ABCDEF"; struct MD5Context md5c; unsigned char outBytes[16]; int i = 0; MD5Init(&md5c); - MD5Update(&md5c, in, strlen(in)); + MD5Update(&md5c, in, len); MD5Final(outBytes, &md5c); out[0] ='\0'; /* reset out buffer */ for (i = 0; i < 16;i++) { |