Skip to content

Commit

Permalink
hashfile: avoid being fine with informative-grade hashes only
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Apr 28, 2016
1 parent 91c5e9b commit 0bd9ab6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/hash.h
Expand Up @@ -53,6 +53,10 @@ class hash_proc

typedef std::map<std::string, factoryof<hash_proc>*> suite_t;
static suite_t& suite();

virtual bool cryptographically_significant() {
return true;
}
};

#endif
Expand Down
7 changes: 6 additions & 1 deletion src/hashfile.cpp
Expand Up @@ -62,6 +62,10 @@ class size64proc : public hash_proc
}
return r;
}

bool cryptographically_significant() {
return false;
}
};

/*
Expand Down Expand Up @@ -164,7 +168,8 @@ int hashfile::verify (istream&in)
continue;
}
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: ;-) "
<< i->first << " is GOOD");
} else {
Expand Down

0 comments on commit 0bd9ab6

Please sign in to comment.