summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/MD5.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-05-31 22:34:56 +0000
committerEric Christopher <echristo@gmail.com>2013-05-31 22:34:56 +0000
commit1ec87e8bb0a36ce592567f3e7b9eeae8a215961b (patch)
tree5c6be3653d6280c185663d659c4c2fe43c5fd6bb /llvm/lib/Support/MD5.cpp
parent85bd745e77495ed2c482708c79076ddbfc609f3c (diff)
downloadbcm5719-llvm-1ec87e8bb0a36ce592567f3e7b9eeae8a215961b.tar.gz
bcm5719-llvm-1ec87e8bb0a36ce592567f3e7b9eeae8a215961b.zip
Add support for adding the contents of a StringRef to the MD5 hash.
llvm-svn: 183054
Diffstat (limited to 'llvm/lib/Support/MD5.cpp')
-rw-r--r--llvm/lib/Support/MD5.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/MD5.cpp b/llvm/lib/Support/MD5.cpp
index 8f180684ff6..514466c750f 100644
--- a/llvm/lib/Support/MD5.cpp
+++ b/llvm/lib/Support/MD5.cpp
@@ -219,6 +219,14 @@ void MD5::update(ArrayRef<uint8_t> 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<uint8_t> 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) {
OpenPOWER on IntegriCloud