svl/source/misc/PasswordHelper.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit 9bc8918cf00b99f6c4a8f1e3f082e5583a4cd02c Author: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> AuthorDate: Tue Dec 5 18:50:29 2023 +0300 Commit: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> CommitDate: Sun Dec 10 10:13:31 2023 +0100 add explainer for the reasoning of fMaxPassStrengthEntropyBits also fixes the typo in the fMaxPassStrengthEntropyBits variable name. Change-Id: I7c9cfcea7253a3e07428c83008b0c072033f33c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160425 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx index cfae72f64937..c98a26eff4af 100644 --- a/svl/source/misc/PasswordHelper.cxx +++ b/svl/source/misc/PasswordHelper.cxx @@ -136,10 +136,13 @@ bool SvPasswordHelper::CompareHashPassword(const uno::Sequence<sal_Int8>& rOldPa double SvPasswordHelper::GetPasswordStrengthPercentage(const char* pPassword) { - // Entropy bits corresponding to 100% password strength - static constexpr double fMaxPassStrengthEntorpyBits = 112.0; + // Entropy bits ≥ 112 are mapped to 100% password strength. + // 112 was picked since according to the linked below KeePass help page, it + // corresponds to a strong password: + // <http://web.archive.org/web/20231128131604/https://keepass.info/help/kb/pw_quality_est.html> + static constexpr double fMaxPassStrengthEntropyBits = 112.0; return std::min(100.0, - ZxcvbnMatch(pPassword, nullptr, nullptr) * 100.0 / fMaxPassStrengthEntorpyBits); + ZxcvbnMatch(pPassword, nullptr, nullptr) * 100.0 / fMaxPassStrengthEntropyBits); } double SvPasswordHelper::GetPasswordStrengthPercentage(const OUString& aPassword)