Skip to content

CheckPasswordStrength 2.1.0

Choose a tag to compare

@venshine venshine released this 09 Nov 15:53
· 8 commits to master since this release

Scoring changes

Non-repeated passwords keep or lose points; nothing scores higher except the date case below. Short passwords are affected most: about 40% of random 4-8 character passwords score lower, while 9-16 character ones barely change (about 0.04%).

  • Length gates apply to whole combination rules. len > k && A || B || ... only gated the first pair, so uppercase scored higher than lowercase and 5-6 character passwords could reach MEDIUM. Ab1!x now scores 3 (EASY) instead of 4.
  • Repeated patterns are scored as their unit. Only halves and thirds were checked before, so Ab1! repeated 5 times scored 13 (EXTREMELY_STRONG). Ab1!Ab1!Ab1! now scores the same as Ab1!, and Passw0rd!Passw0rd! drops from 11 to 7. A repeated unit that is already 16+ characters may gain 1 point, since the old "equal halves" penalty no longer applies.
  • Sequences inside the password are penalized. Runs of 4 or more consecutive letters, digits or keyboard keys anywhere in the password, in either direction and in any case, cost 1 point per kind. Only whole-string sequences were caught before. Qwerty123! drops from 8 to 7.
  • Embedded dates are detected. An 8-digit yyyyMMdd date anywhere in the password (years 1950-2049, real month lengths and leap years) costs 1 point. Tom19881010! drops from 7 to 6. The old rule only looked at all-digit passwords, which already scored 0, so it never changed an ASCII result.

API

  • Only null ("password is null") and the empty string ("password is empty") throw IllegalArgumentException. Blank strings and the literal "null" used to throw and are now scored.

Other

  • Character classes are counted in a single pass and repeat detection uses a KMP prefix function, so scoring is linear time: about 1.3-1.7x faster for a 16-character password, and under 100 ms for a 1,000,000-character input.
  • New Swing sample app: ./gradlew :sample:run.
  • New score snapshot test (test/score-snapshot.tsv) that pins every rule.

See CHANGELOG.md for details.

Installation

repositories {
    maven { url = 'https://jitpack.io' }
}
implementation 'com.github.venshine:CheckPasswordStrength:2.1.0'

Or download the attached jar (Java 8 bytecode).