mirror of
https://github.com/aria2/aria2.git
synced 2025-01-04 09:03:46 +00:00
Fix hash function comparator
This commit is contained in:
parent
528cf5395b
commit
c0b8b471ab
@ -135,9 +135,12 @@ bool MessageDigest::isStronger(const std::string& lhs, const std::string& rhs)
|
||||
FindHashTypeEntry(lhs));
|
||||
auto rEntry = std::find_if(std::begin(hashTypes), std::end(hashTypes),
|
||||
FindHashTypeEntry(rhs));
|
||||
if(lEntry == std::end(hashTypes) || rEntry == std::end(hashTypes)) {
|
||||
if(lEntry == std::end(hashTypes)) {
|
||||
return false;
|
||||
}
|
||||
if(rEntry == std::end(hashTypes)) {
|
||||
return true;
|
||||
}
|
||||
return lEntry->strength > rEntry->strength;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void MessageDigestTest::testIsStronger()
|
||||
CPPUNIT_ASSERT(MessageDigest::isStronger("sha-1", "md5"));
|
||||
CPPUNIT_ASSERT(!MessageDigest::isStronger("md5", "sha-1"));
|
||||
CPPUNIT_ASSERT(!MessageDigest::isStronger("unknown", "sha-1"));
|
||||
CPPUNIT_ASSERT(!MessageDigest::isStronger("sha-1", "unknown"));
|
||||
CPPUNIT_ASSERT(MessageDigest::isStronger("sha-1", "unknown"));
|
||||
}
|
||||
|
||||
void MessageDigestTest::testIsValidHash()
|
||||
|
Loading…
Reference in New Issue
Block a user