X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FMD5.cpp;h=7aaf9a262648b5f974a1525c2a5b7f1dc1cacb81;hb=52fa0d066a8fb81716713b85841b1aa031dbf8fc;hp=8f180684ff69eda33b381152d69fa1cfaec05b6f;hpb=cbb45aa123c42dabb38f14bc1879848d77896998;p=oota-llvm.git diff --git a/lib/Support/MD5.cpp b/lib/Support/MD5.cpp index 8f180684ff6..7aaf9a26264 100644 --- a/lib/Support/MD5.cpp +++ b/lib/Support/MD5.cpp @@ -208,17 +208,25 @@ void MD5::update(ArrayRef Data) { memcpy(&buffer[used], Ptr, free); Ptr = Ptr + free; Size -= free; - body(ArrayRef(buffer, 64)); + body(makeArrayRef(buffer, 64)); } if (Size >= 64) { - Ptr = body(ArrayRef(Ptr, Size & ~(unsigned long) 0x3f)); + Ptr = body(makeArrayRef(Ptr, Size & ~(unsigned long) 0x3f)); Size &= 0x3f; } 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) { @@ -232,7 +240,7 @@ void MD5::final(MD5Result &result) { if (free < 8) { memset(&buffer[used], 0, free); - body(ArrayRef(buffer, 64)); + body(makeArrayRef(buffer, 64)); used = 0; free = 64; } @@ -249,7 +257,7 @@ void MD5::final(MD5Result &result) { buffer[62] = hi >> 16; buffer[63] = hi >> 24; - body(ArrayRef(buffer, 64)); + body(makeArrayRef(buffer, 64)); result[0] = a; result[1] = a >> 8;