Fix handling of small passphrase wordlists

* Fixes #11856
* Set the minimum recommended wordlist size to 1,296 - equal to the EFF Short List
* Issue a clear warning when using a smaller wordlist but do not prevent generation of passphrases
* Improve wording when removing custom wordlist
This commit is contained in:
Jonathan White
2025-05-18 08:51:18 -04:00
parent 20aefd0c7a
commit b5f4e98925
9 changed files with 174 additions and 168 deletions

View File

@@ -99,7 +99,7 @@ void PassphraseGenerator::setWordList(const QString& path)
m_wordlist = wordset.toList();
if (m_wordlist.size() < m_minimum_wordlist_length) {
if (!isWordListValid()) {
qWarning("Wordlist is less than minimum acceptable size: %s", qPrintable(path));
}
}
@@ -117,8 +117,7 @@ void PassphraseGenerator::setWordSeparator(const QString& separator)
QString PassphraseGenerator::generatePassphrase() const
{
// In case there was an error loading the wordlist
if (!isValid() || m_wordlist.empty()) {
if (m_wordlist.isEmpty()) {
return {};
}
@@ -149,7 +148,7 @@ QString PassphraseGenerator::generatePassphrase() const
return words.join(m_separator);
}
bool PassphraseGenerator::isValid() const
bool PassphraseGenerator::isWordListValid() const
{
return m_wordCount > 0 && m_wordlist.size() >= m_minimum_wordlist_length;
return m_wordlist.size() >= m_minWordListSize;
}