summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-12-05 18:50:29 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-12-10 10:13:31 +0100
commit9bc8918cf00b99f6c4a8f1e3f082e5583a4cd02c (patch)
tree30ef0f84af2c754c5fc01bdb0243c89a8b0601ff /svl/source
parent94d0cf4d4e308627922c4afb5e38523ea4f6af37 (diff)
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.extern@allotropia.de>
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/misc/PasswordHelper.cxx9
1 files changed, 6 insertions, 3 deletions
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)