Added color-size check to sigil algorithm.

This commit is contained in:
tastytea 2019-01-02 10:29:27 +01:00
parent 4e5397a2a2
commit ddd55f6221
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 5 additions and 0 deletions

View File

@ -54,6 +54,11 @@ void Identiconpp::check_entropy(const string &digest, algorithm type)
}
case algorithm::sigil:
{
if (_foreground.size() > 256)
{
throw std::invalid_argument(
"sigil algorithm does not support more than 256 colors.");
}
entropy_provided = digest.length() * 4;
entropy_required = (_columns / 2 + _columns % 2) * _rows + 8;
break;