1
0
mirror of https://github.com/biergaizi/codecrypt synced 2024-06-28 09:53:46 +00:00

hashfile: avoid being fine with informative-grade hashes only

This commit is contained in:
Mirek Kratochvil 2016-04-28 21:58:52 +02:00
parent 91c5e9ba35
commit 0bd9ab6d54
2 changed files with 10 additions and 1 deletions

@ -53,6 +53,10 @@ public:
typedef std::map<std::string, factoryof<hash_proc>*> suite_t; typedef std::map<std::string, factoryof<hash_proc>*> suite_t;
static suite_t& suite(); static suite_t& suite();
virtual bool cryptographically_significant() {
return true;
}
}; };
#endif #endif

@ -62,6 +62,10 @@ public:
} }
return r; return r;
} }
bool cryptographically_significant() {
return false;
}
}; };
/* /*
@ -164,7 +168,8 @@ int hashfile::verify (istream&in)
continue; continue;
} }
if (i->second == hm[i->first]->finish()) { if (i->second == hm[i->first]->finish()) {
++ok; //avoid doing a positive decision on informative-grade-only hashes
if (hm[i->first]->cryptographically_significant()) ++ok;
err ("hash verification: ;-) " err ("hash verification: ;-) "
<< i->first << " is GOOD"); << i->first << " is GOOD");
} else { } else {