X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FMD5.cpp;h=514466c750fcc911947581de151cbe14c127c53f;hb=78832c6e7d33094c6ef9e99b07dac6f60c0a1207;hp=ce99ab6abc8315d30643566a33a3638f17fffe79;hpb=800e6ee52fd32e0b129cbccd811166d7e215e6ad;p=oota-llvm.git diff --git a/lib/Support/MD5.cpp b/lib/Support/MD5.cpp index ce99ab6abc8..514466c750f 100644 --- a/lib/Support/MD5.cpp +++ b/lib/Support/MD5.cpp @@ -183,7 +183,7 @@ MD5::MD5() : a(0x67452301), b(0xefcdab89), c(0x98badcfe), d(0x10325476), hi(0), lo(0) { } -/// Incrementally add \p size of \p data to the hash. +/// Incrementally add the bytes in \p Data to the hash. void MD5::update(ArrayRef Data) { MD5_u32plus saved_lo; unsigned long used, free; @@ -219,6 +219,14 @@ void MD5::update(ArrayRef Data) { memcpy(buffer, Ptr, Size); } +/// Add the bytes in the StringRef \p Str to the hash. +// Note that this isn't a string and so this won't include any trailing NULL +// bytes. +void MD5::update(StringRef Str) { + ArrayRef SVal((const uint8_t *)Str.data(), Str.size()); + update(SVal); +} + /// \brief Finish the hash and place the resulting hash into \p result. /// \param result is assumed to be a minimum of 16-bytes in size. void MD5::final(MD5Result &result) {