diff options
author | Eric Christopher <echristo@gmail.com> | 2013-05-24 23:08:17 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-05-24 23:08:17 +0000 |
commit | f7306f224e7f85c2690256636613422c4a7b8230 (patch) | |
tree | 8ed035cec51604f65c10bee3f312106e8600d230 /include/llvm/Support/MD5.h | |
parent | 80d10ded8cd4f34b87d82b03d6f63328ea337b26 (diff) | |
download | llvm-f7306f224e7f85c2690256636613422c4a7b8230.tar.gz llvm-f7306f224e7f85c2690256636613422c4a7b8230.tar.bz2 llvm-f7306f224e7f85c2690256636613422c4a7b8230.tar.xz |
ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/MD5.h')
-rw-r--r-- | include/llvm/Support/MD5.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/Support/MD5.h b/include/llvm/Support/MD5.h index fd52ca54e1..9d306993f0 100644 --- a/include/llvm/Support/MD5.h +++ b/include/llvm/Support/MD5.h @@ -28,10 +28,13 @@ #ifndef LLVM_SYSTEM_MD5_H #define LLVM_SYSTEM_MD5_H +#include "llvm/ADT/SmallString.h" #include "llvm/Support/DataTypes.h" namespace llvm { +template <typename T> class ArrayRef; + class MD5 { // Any 32-bit or wider unsigned integer data type will do. typedef uint32_t MD5_u32plus; @@ -41,17 +44,21 @@ class MD5 { unsigned char buffer[64]; MD5_u32plus block[16]; - public: +public: + typedef unsigned char MD5Result[16]; + MD5(); /// \brief Updates the hash for arguments provided. - void Update(void *data, unsigned long size); + void update(ArrayRef<unsigned char> Data); /// \brief Finishes off the hash and puts the result in result. - void Final(unsigned char *result); + void final(MD5Result &result); + + static void stringifyResult(MD5Result &Res, SmallString<32> &Str); private: - void *body(void *data, unsigned long size); + const unsigned char *body(ArrayRef<unsigned char> Data); }; } |