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

Uploaded Python 3

File details

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

File metadata

  • Download URL: passeval-0.1.9.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.9.tar.gz
Algorithm Hash digest
SHA256 4d0ecd659ead1babc337b851f394835ee4c82a2d52125780b457e5b3597611db
MD5 b2da14b22575f7c96a696f6ba3da92ea
BLAKE2b-256 a44c34219d83b42eea96083cd0ef8ee737e104f9ab79b4e3fd7d740c6e572550

See more details on using hashes here.

File details

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

File metadata

  • Download URL: passeval-0.1.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ad5a485094c080c1e2d60d0379a4c7a8396c3f3f947a4d8b061fc8996d9b3227
MD5 5f97fa5196938c843264caf5b5799496
BLAKE2b-256 40fa185d7b75ba99de487822fee4c835efb5104332d10980b1f198720a5d76dd

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