diff --git a/lib/src/ssl_funcs/Md5.cc b/lib/src/ssl_funcs/Md5.cc index 411d7ef4..318a9c82 100644 --- a/lib/src/ssl_funcs/Md5.cc +++ b/lib/src/ssl_funcs/Md5.cc @@ -51,7 +51,7 @@ uint32_t Md5Encode::fillData(const char *inDataPtr, // int grop_num = bitNum / BIT_OF_GROUP; int modBitNum = bitNum % BIT_OF_GROUP; int bitNeedFill = 0; - if (modBitNum > (BIT_OF_GROUP - SRC_DATA_LEN)) + if (modBitNum >= (BIT_OF_GROUP - SRC_DATA_LEN)) { bitNeedFill = (BIT_OF_GROUP - modBitNum); bitNeedFill += (BIT_OF_GROUP - SRC_DATA_LEN); diff --git a/lib/tests/unittests/MD5Test.cc b/lib/tests/unittests/MD5Test.cc index 5545ae71..8340be2b 100644 --- a/lib/tests/unittests/MD5Test.cc +++ b/lib/tests/unittests/MD5Test.cc @@ -9,4 +9,8 @@ DROGON_TEST(Md5Test) "1234567890") == "49CB3608E2B33FAD6B65DF8CB8F49668"); CHECK(drogon::utils::getMd5("1") == "C4CA4238A0B923820DCC509A6F75849B"); + CHECK(drogon::utils::getMd5("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") == + "59F761506DFA597B0FAF1968F7CCA867"); }