Skip to main content

Offline ML-powered password strength evaluation using a trained Random Forest model.

Project description

passeval

Offline ML-powered password strength evaluation for Python developers.

Built on the PassSafe research model — a Random Forest classifier trained on 220,000 passwords. Runs fully locally, no API, no server.


Installation

pip install passeval

Quick Start

from passeval import evaluate_password

result = evaluate_password("Monkey2024!")
print(result)
{
  "score": 0,
  "label": "Weak",
  "confidence": 1.0,
  "features": {
    "length": 11,
    "entropy": 3.2776,
    "num_upper": 1,
    "num_digits": 4,
    "num_special": 1
  },
  "feedback": [
    "Longer passwords are significantly harder to crack",
    "Avoid predictable patterns like years or repeated digits"
  ]
}

Examples

from passeval import evaluate_password

evaluate_password("hunter2")["label"]                   # Weak
evaluate_password("Password1")["label"]                 # Medium
evaluate_password("blitz8-concrete2-eloquence3")["label"]  # Strong
evaluate_password("xK9#mP2$vL8@")["label"]             # Strong

Key Features

  • 3-class scoring — Weak (0), Medium (1), Strong (2)
  • Confidence score — model probability for the predicted class
  • Actionable feedback — specific suggestions to improve weak passwords
  • Detects breach-derived patterns — catches passwords like Monkey2024! that pass surface-level complexity checks
  • Fully offline — model ships inside the package, no internet required
  • Fast after warmup — model cached in memory, sub-millisecond from second call onward

How It Works

passeval extracts 10 statistical features from each password — length, entropy, character type counts, and boolean flags — then runs them through a trained Random Forest classifier. No raw characters are inspected; the model learns structural patterns, not specific passwords.

from passeval import extract_features

extract_features("Monkey2024!")
# {
#   'length': 11, 'num_upper': 1, 'num_lower': 6, 'num_digits': 4,
#   'num_special': 1, 'entropy': 3.2776, 'unique_chars': 10,
#   'has_upper': 1, 'has_digit': 1, 'has_special': 1
# }

vs zxcvbn

Unlike zxcvbn (rule-based, 55.37% accuracy on the PassSafe dataset), passeval correctly flags passwords like Monkey2024!, Dragon!, and Football!2024 as Weak — patterns that satisfy complexity rules but originate from breached credentials. On realistic weak password detection, the ML model achieves 99.93% vs zxcvbn's 32.34%.


Research

passeval is the inference library for the PassSafe paper:

Amgbara, S.I. (2026). PassSafe: An Intelligent Password Manager Integrating Machine Learning for Adaptive Password Strength Evaluation. Department of Computer Science, University of Hertfordshire, UK.


License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

passeval-0.1.6.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

passeval-0.1.6-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file passeval-0.1.6.tar.gz.

File metadata

  • Download URL: passeval-0.1.6.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for passeval-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a50355f0b7a41625b8d53f26d65e0dc37088f8987f31421ab3ab508e445c691d
MD5 557608ccf71885d62c9e89a19d8d59f4
BLAKE2b-256 1003a6ee441195d610132b665b33db6cbc500413217d003775c5c455d35d94e6

See more details on using hashes here.

File details

Details for the file passeval-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: passeval-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for passeval-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3b8824104c46f34a1527c783bea5b7fa642b09ba75e3a9289050c175e264e07b
MD5 c22c39886a4d2e062e35e333b19ba03d
BLAKE2b-256 b6969c0d97b3fd94f4ffaaf679d02b19f9c99b828dcae771bfa278ffd51b4984

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page