*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
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]);
/* Closing it */
fclose(fp);
-
+
return(0);
}
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++)
{