7d0656145179566289653fb49bf66a60873fe282
angie
  Wed Oct 9 10:39:22 2013 -0700
Added md5HexForString.
diff --git src/lib/md5.c src/lib/md5.c
index fed2e93..2666eef 100644
--- src/lib/md5.c
+++ src/lib/md5.c
@@ -251,30 +251,47 @@
     byteToHex( md5[i], h++);  // note h is incremented here and also at the top of the loop
     }
 hex[32] = 0;
 return cloneString(hex);
 }
 
 char *md5HexForFile(char * fileName)
 /* read f in buffer pieces and return hex string for md5sum */
 {
 // MD5 COMPUTE
 unsigned char md5[16];       /* Keep the md5 checksum here. */
 md5ForFile(fileName,md5);
 return md5ToHex(md5);
 }
 
+void md5ForString(char *string, unsigned char md5[16])
+/* Compute md5 sum on string. */
+{
+struct md5_context ctx;
+md5_starts(&ctx);
+md5_update(&ctx, (uint8 *)string, strlen(string));
+md5_finish(&ctx, md5);
+}
+
+char *md5HexForString(char *string)
+/* Return hex string for md5sum of string. */
+{
+unsigned char md5[16];
+md5ForString(string, md5);
+return md5ToHex(md5);
+}
+
 struct hash *md5FileHash(char *fileName)
 /* Read md5sum file and return a hash keyed by file names with md5sum values. */
 {
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[2];
 struct hash *hash = hashNew(0);
 while (lineFileRow(lf, row))
     hashAdd(hash, row[1], cloneString(row[0]));
 lineFileClose(&lf);
 return hash;
 }
 
 #ifdef TEST
 
 #include <stdio.h>