diff options
| author | Eric Christopher <echristo@gmail.com> | 2013-05-31 22:34:56 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2013-05-31 22:34:56 +0000 |
| commit | 769d24a60d798ffa3a47a01c9e7a0dcfaefbb882 (patch) | |
| tree | ab2cfdce8673ac61af087d766cd51333ce2bb490 /lib/Support | |
| parent | cbb45aa123c42dabb38f14bc1879848d77896998 (diff) | |
| download | external_llvm-769d24a60d798ffa3a47a01c9e7a0dcfaefbb882.zip external_llvm-769d24a60d798ffa3a47a01c9e7a0dcfaefbb882.tar.gz external_llvm-769d24a60d798ffa3a47a01c9e7a0dcfaefbb882.tar.bz2 | |
Add support for adding the contents of a StringRef to the MD5 hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
| -rw-r--r-- | lib/Support/MD5.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Support/MD5.cpp b/lib/Support/MD5.cpp index 8f18068..514466c 100644 --- a/lib/Support/MD5.cpp +++ b/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) { |
