English | 简体中文
CheckPasswordStrength is an open-source Java library for checking password strength.
{"password", "abc123", "iloveyou", "adobe123", "123123", "sunshine","1314520", "a1b2c3", "123qwe", "aaa111", "qweasd", "admin", "passwd"}
- 0-3 : [easy]
- 4-6 : [medium]
- 7-9 : [strong]
- 10-12 : [very strong]
- >12 : [extremely strong]
Pure Java with no third-party dependencies. It can be called directly from both Java and Kotlin (JVM / Android).
public static void main(String[] args) {
String passwd = "2hAj5#mne-ix.86H";
System.out.println(CheckStrength.checkPasswordStrength(passwd));
} CheckStrength.LEVEL level = CheckStrength.getPasswordLevel(passwd); // EASY / MEDIUM / STRONG / VERY_STRONG / EXTREMELY_STRONGimport com.wx.pwd.CheckStrength
fun main() {
val passwd = "2hAj5#mne-ix.86H"
println(CheckStrength.checkPasswordStrength(passwd)) // strength score
when (CheckStrength.getPasswordLevel(passwd)) {
CheckStrength.LEVEL.EASY, CheckStrength.LEVEL.MEDIUM -> println("Password is too weak")
else -> println("Password is strong enough")
}
}repositories {
maven { url = 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.venshine:CheckPasswordStrength:2.0.0'
}repositories {
maven("https://jitpack.io")
}
dependencies {
implementation("com.github.venshine:CheckPasswordStrength:2.0.0")
}2.0.0 fixes consecutive sequence detection, dictionary word detection and a crash on very long numeric passwords, so some passwords score differently than in 1.x. The enum
LEVEL.MIDIUMhas been renamed toLEVEL.MEDIUM. See the CHANGELOG.
./test.sh- Email: venshine.cn@gmail.com
Copyright (C) 2014 venshine.cn@gmail.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.