reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 91b73c799688362b994a3dad26ecaf6b14019354
parent 211004a31df9b573ef31208840b7a753b0661414
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Fri,  7 Dec 2018 22:26:33 -0500

oops, fix hash algorithm detection

Diffstat:
Msrc/hash.cpp | 2+-
Mtest/hash.cpp | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/hash.cpp b/src/hash.cpp @@ -180,7 +180,7 @@ bool Hash::getAlgorithm(const std::string &hash, Algorithm *out) if(sscanf(hash.c_str(), "%2x%2x", &algo, &size) != 2) return false; - if(hash.size() != size + 4) + if(hash.size() != (size * 2) + 4) return false; switch(algo) { diff --git a/test/hash.cpp b/test/hash.cpp @@ -44,10 +44,10 @@ TEST_CASE("get hash algorithm", M) { REQUIRE_FALSE(Hash::getAlgorithm("12", &algo)); SECTION("unexpected size") - REQUIRE_FALSE(Hash::getAlgorithm("1204ab", &algo)); + REQUIRE_FALSE(Hash::getAlgorithm("1202ab", &algo)); SECTION("seemingly good (but not actually) sha-256") { - REQUIRE(Hash::getAlgorithm("1204abcd", &algo)); + REQUIRE(Hash::getAlgorithm("1202abcd", &algo)); REQUIRE(algo == Hash::SHA256); } }