<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 24, 2013 at 5:08 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: echristo<br>
Date: Fri May 24 18:08:17 2013<br>
New Revision: 182692<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=182692&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=182692&view=rev</a><br>
Log:<br>
ArrayRef-ize MD5 and clean up a few variable names.<br>
Add a stringize method to make dumping a bit easier, and add a testcase<br>
exercising a few different paths.<br>
<br>
Added:<br>
    llvm/trunk/unittests/Support/MD5Test.cpp<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/MD5.h<br>
    llvm/trunk/lib/Support/MD5.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Support/MD5.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MD5.h?rev=182692&r1=182691&r2=182692&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MD5.h?rev=182692&r1=182691&r2=182692&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/Support/MD5.h (original)<br>
+++ llvm/trunk/include/llvm/Support/MD5.h Fri May 24 18:08:17 2013<br>
@@ -28,10 +28,13 @@<br>
 #ifndef LLVM_SYSTEM_MD5_H<br>
 #define LLVM_SYSTEM_MD5_H<br>
<br>
+#include "llvm/ADT/SmallString.h"<br>
 #include "llvm/Support/DataTypes.h"<br>
<br>
 namespace llvm {<br>
<br>
+template <typename T> class ArrayRef;<br>
+<br></blockquote><div><br></div><div style>Is it legit to forward-declare this and then take an ArrayRef by value?</div><div style> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

 class MD5 {<br>
   // Any 32-bit or wider unsigned integer data type will do.<br>
   typedef uint32_t MD5_u32plus;<br>
@@ -41,17 +44,21 @@ class MD5 {<br>
   unsigned char buffer[64];<br>
   MD5_u32plus block[16];<br>
<br>
- public:<br>
+public:<br>
+  typedef unsigned char MD5Result[16];<br>
+<br>
   MD5();<br>
<br>
   /// \brief Updates the hash for arguments provided.<br>
-  void Update(void *data, unsigned long size);<br>
+  void update(ArrayRef<unsigned char> Data);<br>
<br>
   /// \brief Finishes off the hash and puts the result in result.<br>
-  void Final(unsigned char *result);<br>
+  void final(MD5Result &result);<br>
+<br>
+  static void stringifyResult(MD5Result &Res, SmallString<32> &Str);</blockquote><div style><br></div><div style>stringifyResult could use a comment describing what it does. My best guess is that it produces an ASCII hex digest, but it's not clear. If that is what it does, then just call it something with "ASCIIHexDigest" in the name. Also, can it be a free function?</div>
<div style><br></div><div style><br></div><div style>Side note: on my system, adding the SmallString.h include pulls in over 25K lines of code :( (it's mostly through SmallVector.h) sigh...</div><div style><br></div><div style>
-- Sean Silva</div><div style><br></div></div></div></div>