codename-cz/passy

密码检测器,非常简单。

dev-master 2021-12-21 08:18 UTC

This package is auto-updated.

Last update: 2024-09-21 15:11:59 UTC


README

密码复杂度评分库。我们创建它是为了比 zxcvbn 更简单(目前它在 php 8.1 中抛出警告)。

我们不提供任何保证,使用时请自行负责。

限制

  • 仅在 PHP 8.1 中测试
  • 没有字典或泄露密码检查

使用方法

$p = new Passy();
$score = $p->score($password);
if ($score <= 65) {
    die('Password is unsecure, try adding more symbols or use longer passphrase.')
}

如何计算分数?

  • 字符串字符按类别排序:数字、大写字母、小写字母和符号(任何其他字符)。
  • 计算唯一字符数量
  • 计算唯一符号数量

最终分数计算为:passwordLength + (10 * nonEmptyCategories) + (uniqueCharacters * 0.5) + (2 * uniqueSymbols),然后向下取整并降低到100。

例如 LetMeKno*w2* 得到58。

我们是如何得到这个公式的?

我们凭直觉估算的。

许可证

MIT

贡献

提交一个问题,我们会讨论它,然后让我们开始编码!