proxygen
CryptUtilTest.cpp File Reference
#include <folly/portability/GTest.h>
#include <proxygen/lib/utils/CryptUtil.h>
#include <string>

Go to the source code of this file.

Functions

 TEST (CryptUtilTest, Base64EncodeTest)
 
 TEST (CryptUtilTest, MD5EncodeTest)
 

Function Documentation

TEST ( CryptUtilTest  ,
Base64EncodeTest   
)

Definition at line 18 of file CryptUtilTest.cpp.

References ASSERT_EQ, and proxygen::base64Encode().

18  {
19  ASSERT_EQ("",
21  ByteRange(
22  reinterpret_cast<const unsigned char*>(""), (size_t) 0)));
23  ASSERT_EQ("YQ==",
25  ByteRange(
26  reinterpret_cast<const unsigned char*>("a"), 1)));
27  ASSERT_EQ("YWE=",
29  ByteRange(
30  reinterpret_cast<const unsigned char*>("aa"), 2)));
31  ASSERT_EQ("QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
33  ByteRange(
34  reinterpret_cast<const unsigned char*>("Aladdin:open sesame"), 19)));
35 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
std::string base64Encode(folly::ByteRange text)
Definition: CryptUtil.cpp:21
Range< const unsigned char * > ByteRange
Definition: Range.h:1163
TEST ( CryptUtilTest  ,
MD5EncodeTest   
)

Definition at line 37 of file CryptUtilTest.cpp.

References ASSERT_EQ, and proxygen::md5Encode().

37  {
38  ASSERT_EQ("d41d8cd98f00b204e9800998ecf8427e",
39  md5Encode(
40  ByteRange(
41  reinterpret_cast<const unsigned char*>(""),
42  (size_t) 0)));
43  ASSERT_EQ("a7a93b8ac14a48faa68e4afb57b00fc7",
44  md5Encode(
45  ByteRange(
46  reinterpret_cast<const unsigned char*>("Aladdin:open sesame"),
47  19)));
48 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
std::string md5Encode(folly::ByteRange text)
Definition: CryptUtil.cpp:60
Range< const unsigned char * > ByteRange
Definition: Range.h:1163