psecio / pwdcheck
密码复杂度验证器
1.0
2014-01-04 13:27 UTC
Requires
- php: >=5.3.1
- psecio/iniscan: *
This package is auto-updated.
Last update: 2024-09-15 10:45:49 UTC
README
Pwdcheck
工具使用 Wolfram Alpha 方法来估计密码强度。它通过一系列检查为密码赋予一个“得分”
- 0-60:非常弱
- 60-70:弱
- 70-80:一般
- 80-90:强
- 90-100:非常强
安装
您可以使用 Composer 安装 Pwdcheck
{
"require": {
"psecio/pwdcheck": "1.*"
}
}
用法
该工具的用法简单,您可以获取密码强度的文本版本(例如“非常弱”)或从零到四的数字表示
<?php require_once 'vendor/autoload.php'; $p = new \Psecio\Pwdcheck\Password(); $p->evaluate($password); // getting the numeric representation: echo 'Strength: '.$p->getStrength()."\n"; // getting the text version: echo 'Strength: '.$p->getStrength(true)."\n"; // you can also get the raw score either as a return value or using getScore $result = $p->evaluate($password); echo 'Score: '.$result."\n" echo 'Score: '.$p->getScore()."\n";