Skip to content

PwScore 3.0.0

Choose a tag to compare

@venshine venshine released this 16 Nov 06:59
· 5 commits to master since this release

CheckPasswordStrength is now PwScore: the same scoring rules, with the same results, in 14 languages, plus an online demo that scores passwords locally in your browser.

Languages

Java, Kotlin (Multiplatform), Swift, Objective-C, Dart, JavaScript, Python, Go, Rust, C, C++, C#, Ruby and Perl. Every implementation is tested against the same snapshot of 179 expected scores (spec/score-snapshot.tsv). The rules are specified in spec/SPEC.md. See the README for how to install and call each one.

Scoring changes

The rules were reworked to close ways of making weak passwords look strong. Of the 118 cases in the 2.1.0 snapshot, 77 keep their score, 28 go up and 13 go down.

  • Length is a continuous ladder from -2 (4 characters or fewer) to +5 (24 or more), measured as effective length: a run of one character counts as 2 and back-to-back repeated pieces count once (Ab1!Ab1!Ab1!x: 12 → 3).
  • Character-class thresholds count distinct characters (Pa1! followed by eleven !: 10 → 3).
  • Fullwidth ASCII is folded to ASCII; other non-ASCII characters form their own class instead of counting as symbols, and an emoji counts as one character.
  • The dictionary grows from 13 to 84 words (English, pinyin, digit patterns), matches substitutions such as p@ssw0rd, and subtracts 2.
  • Years and ddMMyyyy, MMddyyyy and yyMMdd dates are detected, as are keyboard columns, diagonals and the shifted symbol row; passwords mostly made of sequences lose one more point.
  • A password made of few distinct characters loses a point; the "all one class" penalty now applies only below 6 characters.
  • Fixed the all-same-character check, which treated spaces and other characters up to U+0020 as equal to the first one.

API (breaking)

2.x 3.0.0
com.github.venshine:CheckPasswordStrength com.github.venshine:PwScore
com.wx.pwd.CheckStrength.checkPasswordStrength(s) io.github.venshine.pwscore.PwScore.score(s)
CheckStrength.getPasswordLevel(s) PwScore.level(s)
CheckStrength.LEVEL PwScore.Level
com.wx.pwd.StringUtils removed

Installation

  • Java: implementation 'com.github.venshine:PwScore:3.0.0' from JitPack, or the PwScore.jar attached below
  • Go: go get github.com/venshine/PwScore/go/v3@v3.0.0
  • Swift / Objective-C: Swift Package Manager, from: "3.0.0"
  • Other languages: see the README