Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
Z

zxcvbn4j

> 编程语言
Open source

This is a java port of zxcvbn, which is a JavaScript password strength generator.

362 stars0 likes0 views
WebsiteGitHub

About

This is a java port of zxcvbn, which is a JavaScript password strength generator.

zxcvbn4j

This is a Java version of zxcvbn, a password strength estimator originally written in JavaScript and inspired by password cracking tools. It uses pattern matching and conservative estimation to assess the strength of passwords. It can identify and evaluate the strength of over 30,000 common passwords, as well as common names and surnames based on US census data. It also recognizes popular English words from Wikipedia, US television shows, and movies. Additionally, it can detect other common password patterns such as dates, repeated characters (aaa), sequences (abcd), keyboard patterns (qwertyuiop), and l33t speak.

Related articles:

  • Five Algorithms to Measure Real Password Strength

Table of Contents

  • Mapping Original to Ported Versions
  • Special Features
    • Customize Internal Dictionaries and Keyboards
    • Localize Feedback Messages
    • Default Language Support
    • JIS Keyboard Layout Support
    • Accepting Passwords as CharSequence or String
  • Install
  • Development
  • Usage
    • Basic
    • Strength Properties
    • Customize internal dictionaries and keyboards
      • Use resources on the classpath
      • Use resources get via HTTP
      • Use file resources other than classpath
      • Use all default resources
      • Select from and use default resources
    • Localize feedback messages
      • Localize each feedback
      • Localize each locale
  • Requires Java
  • Using this library
  • Bugs and Feedback
  • License

Mapping Original to Ported Versions

Ported Version Original zxcvbn Version
1.2.3 - latest 4.4.2
1.2.1 - 1.2.2 4.4.1
1.1.0 - 1.2.0 4.4.0
1.0.0 - 1.0.2 4.2.0

Special Features

Customize Internal Dictionaries and Keyboards

  • You can customize the dictionary and keyboard layout used by the measurement algorithm to better suit your specific needs.

Localize Feedback Messages

  • zxcvbn4j allows you to localize the default English feedback messages into other languages.

Default Language Support

  • English (default)
  • Japanese (ja)
  • Dutch (nl)
  • German (de)
  • French (fr)
  • Italian (it)
  • Spanish (es)
  • Portuguese (pt)

JIS Keyboard Layout Support

  • zxcvbn4j includes support for the JIS keyboard layout in spatial matching.

Accepting Passwords as CharSequence or String

  • This feature provides greater flexibility in the format of the password input.
  • It also aims to avoid using Strings for any sensitive intermediate objects, enhancing security.

Install

https://central.sonatype.com/artifact/com.nulab-inc/zxcvbn/1.9.0

Gradle:

compile 'com.nulab-inc:zxcvbn:1.9.0'

Maven:


  com.nulab-inc
  zxcvbn
  1.9.0

Development

bash
$ git clone https://github.com/nulab/zxcvbn4j.git
$ cd ./zxcvbn4j
$ ./gradlew build    # build
$ ./gradlew test     # test
$ ./gradlew jmh      # benchmark

Usage

Basic

This is also available Android.

java
Zxcvbn zxcvbn = new Zxcvbn();
Strength strength = zxcvbn.measure("This is password");

If you want to add your own dictionary, put the keyword list of List type to the second argument.

java
List sanitizedInputs = new ArrayList();
sanitizedInputs.add("nulab");
sanitizedInputs.add("backlog");
sanitizedInputs.add("cacoo");
sanitizedInputs.add("typetalk");

Zxcvbn zxcvbn = new Zxcvbn();
Strength strength = zxcvbn.measure("This is password", sanitizedInputs);

Strength Properties

The return result is "Strength". It's almost the same as zxcvbn.

…

Defined Key and the message in the properties file. Reference the messages.properties.

Localize each locale

java
Strength strength = zxcvbn.measure(password);
Feedback feedback = strength.getFeedback();

Map messages = new HashMap<>();
messages.put(Locale.JAPANESE, ResourceBundle.getBundle("This is bundle name", Locale.JAPANESE));
messages.put(Locale.ITALIAN, ResourceBundle.getBundle("This is bundle name", Locale.ITALIAN));
Feedback replacedFeedback = feedback.replaceResourceBundle(messages);

Requires Java

  • Java 1.7+

Using this library

  • Backlog
  • Cacoo
  • Typetalk
  • JetBrains Hub
  • Cryptomator
  • And many Open Source Software
    • https://github.com/search?q=com.nulab-inc+zxcvbn&type=code
    • https://mvnrepository.com/artifact/com.nulab-inc/zxcvbn/usages

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

License

MIT License

  • http://www.opensource.org/licenses/mit-license.php

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javajavapasswordzxcvbn

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言