Fix a md5 sum bug without openssl (#951)
This commit is contained in:
parent
1c04b1a419
commit
64f9f8b87f
|
@ -51,7 +51,7 @@ uint32_t Md5Encode::fillData(const char *inDataPtr,
|
||||||
// int grop_num = bitNum / BIT_OF_GROUP;
|
// int grop_num = bitNum / BIT_OF_GROUP;
|
||||||
int modBitNum = bitNum % BIT_OF_GROUP;
|
int modBitNum = bitNum % BIT_OF_GROUP;
|
||||||
int bitNeedFill = 0;
|
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 - modBitNum);
|
||||||
bitNeedFill += (BIT_OF_GROUP - SRC_DATA_LEN);
|
bitNeedFill += (BIT_OF_GROUP - SRC_DATA_LEN);
|
||||||
|
|
|
@ -9,4 +9,8 @@ DROGON_TEST(Md5Test)
|
||||||
"1234567890") ==
|
"1234567890") ==
|
||||||
"49CB3608E2B33FAD6B65DF8CB8F49668");
|
"49CB3608E2B33FAD6B65DF8CB8F49668");
|
||||||
CHECK(drogon::utils::getMd5("1") == "C4CA4238A0B923820DCC509A6F75849B");
|
CHECK(drogon::utils::getMd5("1") == "C4CA4238A0B923820DCC509A6F75849B");
|
||||||
|
CHECK(drogon::utils::getMd5("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
|
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
|
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") ==
|
||||||
|
"59F761506DFA597B0FAF1968F7CCA867");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue