X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_crypto%2Fmd5%2Fmd5_op.c;h=6785697a11bc2a08e08bbe1b8442784dc0d4c2d0;hp=9e3dc5dafb750cad6a51bc0e1bf0b791462afc5e;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/os_crypto/md5/md5_op.c b/src/os_crypto/md5/md5_op.c index 9e3dc5d..6785697 100755 --- a/src/os_crypto/md5/md5_op.c +++ b/src/os_crypto/md5/md5_op.c @@ -29,25 +29,25 @@ int OS_MD5_File(char * fname, char * output) unsigned char buf[1024 +1]; unsigned char digest[16]; int n; - + memset(output,0, 33); buf[1024] = '\0'; - + fp = fopen(fname,"r"); if(!fp) { return(-1); } - + MD5Init(&ctx); while((n = fread(buf, 1, sizeof(buf) -1, fp)) > 0) { buf[n] = '\0'; MD5Update(&ctx,buf,n); } - + MD5Final(digest, &ctx); - + for(n = 0;n < 16; n++) { snprintf(output, 3, "%02x", digest[n]); @@ -56,7 +56,7 @@ int OS_MD5_File(char * fname, char * output) /* Closing it */ fclose(fp); - + return(0); } @@ -64,17 +64,17 @@ int OS_MD5_File(char * fname, char * output) int OS_MD5_Str(char * str, char * output) { unsigned char digest[16]; - + int n; - + MD5_CTX ctx; MD5Init(&ctx); - + MD5Update(&ctx,(unsigned char *)str,strlen(str)); - + MD5Final(digest, &ctx); - + output[32] = '\0'; for(n = 0;n < 16;n++) {