zxcvbn Type Stubs

4.5.0.20260408 · active · verified Thu Apr 16

types-zxcvbn is a PEP 561 type stub package providing static type annotations for the zxcvbn library, a realistic password strength estimator. It is part of the typeshed project and is designed to be used by type checkers like MyPy or Pyright. This package aims to provide accurate annotations for zxcvbn==4.5.* and is updated regularly as part of typeshed's release cycle, often daily.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `zxcvbn` function and use it to evaluate a password's strength, providing user inputs to penalize common personal information. The results dictionary contains detailed information, including a score, crack time estimates, and feedback.

from zxcvbn import zxcvbn

password = 'correct horse battery staple'
user_inputs = ['correct', 'horse', 'battery', 'staple']

# Evaluate password strength
results = zxcvbn(password, user_inputs=user_inputs)

print(f"Password: {results['password']}")
print(f"Score: {results['score']}/4 (0=terrible, 4=great)")
print(f"Feedback: {results['feedback']['suggestions']}")
print(f"Estimated crack time: {results['crack_times_display']['online_no_throttling_10_per_second']}")

view raw JSON →