| File: | 
tests/StrengthCheckerTest.php | 
 
| Role: | 
Class source | 
 
| Content type: | 
text/plain | 
 
| Description: | 
Class source | 
 
| Class: | 
PHP Password Validation Helper 
Generate and check a password according to rules | 
 
| Author: | 
By John Conde | 
 
|  Last change: | 
feat: Refactor password strength scoring to use a 1-100 scale 
 
This commit introduces a comprehensive scoring system for password strength, replacing the previous categorical approach. The new system evaluates passwords based on four key factors: 
 
- Length (up to 30 points): Rewards passwords between 8 and 20 characters. 
- Character Variety (up to 30 points): Awards points for using uppercase, lowercase, numbers, and special characters, with bonuses for mixed case and multiple character types. 
- Complexity (up to 20 points): Checks for repeated characters, sequential patterns, common passwords, and dictionary words. 
- Entropy (up to 20 points): Calculates password entropy based on character set size and length. 
 
Key improvements: 
- Early returns for empty and very short passwords (score of 1) 
- Robust checks for common patterns and keyboard sequences 
- Comprehensive test suite using data providers 
- Type-safe implementation with strict return types 
 
The scoring system now provides a more granular and accurate assessment of password strength, making it easier to enforce security policies and guide users toward stronger passwords. 
 
Tests: 60 tests, 114 assertions 
 | 
 
| Date: | 
11 days ago | 
 
| Size: | 
5,075 bytes | 
 
 | 
 
 
 | 
 |