From f7306f224e7f85c2690256636613422c4a7b8230 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 24 May 2013 23:08:17 +0000 Subject: 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 --- include/llvm/Support/MD5.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/llvm/Support/MD5.h') 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 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 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 Data); }; } -- cgit v1.2.3