1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Add a comment and some tests including the NULL byte.

llvm-svn: 182900
This commit is contained in:
Eric Christopher 2013-05-30 00:43:26 +00:00
parent cab3fa1f1c
commit 30048ba007

View File

@ -19,6 +19,7 @@
using namespace llvm; using namespace llvm;
namespace { namespace {
/// \brief Tests an arbitrary set of bytes passed as \p Input.
void TestMD5Sum(ArrayRef<unsigned char> Input, StringRef Final) { void TestMD5Sum(ArrayRef<unsigned char> Input, StringRef Final) {
MD5 Hash; MD5 Hash;
Hash.update(Input); Hash.update(Input);
@ -38,5 +39,13 @@ TEST(MD5Test, MD5) {
(const unsigned char *)"abcdefghijklmnopqrstuvwxyz", (const unsigned char *)"abcdefghijklmnopqrstuvwxyz",
(size_t) 26), (size_t) 26),
"c3fcd3d76192e4007dfb496cca67e13b"); "c3fcd3d76192e4007dfb496cca67e13b");
TestMD5Sum(ArrayRef<unsigned char>((const unsigned char *)"\0", (size_t) 1),
"93b885adfe0da089cdf634904fd59f71");
TestMD5Sum(ArrayRef<unsigned char>((const unsigned char *)"a\0", (size_t) 2),
"4144e195f46de78a3623da7364d04f11");
TestMD5Sum(ArrayRef<unsigned char>(
(const unsigned char *)"abcdefghijklmnopqrstuvwxyz\0",
(size_t) 27),
"81948d1f1554f58cd1a56ebb01f808cb");
} }
} }