06c3a006039b571365100c3dd6783a1ffbf3858e
kent
  Fri Sep 5 12:04:10 2014 -0700
Replaced md5hash function with equivalent call to md5ForFile library function.
diff --git src/hg/hgTables/genomeSpace.c src/hg/hgTables/genomeSpace.c
index 2031695..ba0236a 100644
--- src/hg/hgTables/genomeSpace.c
+++ src/hg/hgTables/genomeSpace.c
@@ -11,50 +11,30 @@
 #include "net.h"
 #include "hgConfig.h"
 
 #include <sys/wait.h>
 
 // Declare external global variables that must be reset when
 // before outputting a new page.  Used for outputting multiple pages.
 extern boolean webHeadAlreadyOutputed;
 extern boolean webInTextMode;
 extern struct hash *includedResourceFiles;
 extern boolean htmlWarnBoxSetUpAlready;
 // note there is also an inWeb boolean in cart.c 
 //  that would have needed resetting, but I added a line
 //  in webEnd() to reset it.
 
-void md5hash(char * fileName, unsigned char md5[16])
-/* read f in buffer pieces and update md5 hash */
-{
-struct md5_context ctx;
-unsigned char buffer[MD5READBUFSIZE];
-int bufRead = 0;
-FILE *f = mustOpen(fileName,"rb");
-
-md5_starts(&ctx);
-
-while ((bufRead = fread(&buffer, 1, MD5READBUFSIZE, f)) > 0) 
-    {
-    md5_update(&ctx, buffer, bufRead);
-    }
-
-md5_finish(&ctx, md5);
-carefulClose(&f);
-}
-
-
 boolean doGenomeSpace()
 /* has the send to GenomeSpace checkbox been selected? */
 {
 return cartUsualBoolean(cart, "sendToGenomeSpace", FALSE);
 }
 
 static void showMissingOutputFileForm()
 /* User needs to specify the output file */
 {
 htmlOpen("GenomeSpace");
 printf("Please specify the output file field for GenomeSpace Data Manager.");
 printf("<br>");
 printf("<br>");
 // TODO handle filename with a path.
 // ACTUALLY, this probably just works.
@@ -667,31 +647,31 @@
         "<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"Back\" >\n"
 	"<INPUT TYPE=SUBMIT NAME=\"Refresh\" VALUE=\"Refresh\" onclick='window.location=window.location;return false;' >"
 	"</FORM>\n"
 	, hgtaDoMainPage);
 puts("<script type=\"text/JavaScript\">");
 puts("<!--");
 puts("setTimeout(\"location = location;\",5000);");
 puts("-->");
 puts("</script>");
 
 htmlClose();
 fflush(stdout);
 
 // MD5 COMPUTE
 unsigned char md5[16];       /* Keep the md5 checksum here. */
-md5hash(trashFileName,md5);
+md5ForFile(trashFileName,md5);
 char *hexMd5 = md5ToHex(md5);
 char *base64Md5 = base64Encode((char*)md5, 16);
 
 
 char *s3UploadUrl = gsUploadUrl(gsToken, user, fileName, fSize, base64Md5, contentType);
 
 char *s3Response = gsS3Upload(s3UploadUrl, trashFileName, fSize, base64Md5, hexMd5, contentType, TRUE, fileName);
     
 if (sameString(s3Response,""))
     {
     // Reset global flags before drawing brand new page
     webHeadAlreadyOutputed = FALSE;
     webInTextMode = FALSE;
     includedResourceFiles = NULL;
     htmlWarnBoxSetUpAlready=FALSE;