Added check to make sure digest ist hexadecimal.

This commit is contained in:
tastytea 2018-12-26 23:22:32 +01:00
parent 43865a6b4e
commit aab1e4c57f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,14 @@
void Identiconpp::check_entropy(const string &digest, algorithm type)
{
if (std::any_of(digest.begin(), digest.end(), not_hex))
{
throw std::invalid_argument
(
"Colors must consist of hexadecimal digits (" + digest + ")."
);
}
uint16_t entropy_provided;
uint16_t entropy_required;
switch (type)