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 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, 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 rule-based estimators like zxcvbn, passeval detects breach-derived patterns such as Monkey2024! that satisfy complexity rules but remain guessable.

On realistic weak password detection:

  • passeval (ML): 99.93%
  • zxcvbn (rule-based): 32.34%

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.2.0.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.2.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: passeval-0.2.0.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.2.0.tar.gz
Algorithm Hash digest
SHA256 e04936884aafaf35aebc7fa1039727cddc5d80d8fbdccd94034df92079f99492
MD5 e767d70ca2148637ce9a818d378a60e8
BLAKE2b-256 7942852aa805a371d41f5ea57a57d41629a817d0ad5c957ef2c44bfa75bad460

See more details on using hashes here.

File details

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

File metadata

  • Download URL: passeval-0.2.0-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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a22b54bd37c871fd2a88423b5b41da11581a4c83afba426609c20c6eff79287
MD5 6aaa404d5fa41fc2369dfc1d6ea7a7e0
BLAKE2b-256 962ec946c618675c0a1ba6386a769a96d398bb7004c3a343fd4698edaede3822

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