Skip to main content

Tiny zero-dependency library to estimate password entropy (bits), character-set composition and a strength label.

Project description

password-entropy-meter

Tiny, zero-dependency Python library to estimate password entropy (in bits), character-set composition, and a strength label.

⚠️ Character-set entropy is a theoretical upper bound. It overstates the strength of human-chosen passwords (dictionary words, P@ssw0rd!-style patterns). For realistic guess estimation, use a model such as zxcvbn. Use this for quick checks and education.

Install

pip install password-entropy-meter

Usage

from password_entropy_meter import estimate, entropy_bits

estimate("correct horse battery staple")
# {'length': 28, 'charset': 26, 'bits': 131.6, 'strength': 'very strong'}

estimate("P@ssw0rd!")
# {'length': 9, 'charset': 95, 'bits': 59.1, 'strength': 'reasonable'}  # but trivially guessable in practice

entropy_bits("hunter2")   # 32.9

Why length beats complexity

Each extra random character multiplies the search space; composition rules add entropy only once. A random multi-word passphrase reaches very high entropy that is actually realised, because the words are chosen randomly. See a browser-based checker (entropy + breach exposure) at PwdFortress.

API

  • entropy_bits(password) -> float — bits = length * log2(charset_size)
  • charset_size(password) -> int
  • estimate(password) -> dict{length, charset, bits, strength}

License

MIT

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

password_entropy_meter-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

password_entropy_meter-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file password_entropy_meter-1.0.0.tar.gz.

File metadata

  • Download URL: password_entropy_meter-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for password_entropy_meter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3b1bff9389700c35b1d8f585a1244d7ac3b21de2e624bdccc636cbff724bdcb7
MD5 7cc7aeed52ba957c6bd9c5bbf4eae80b
BLAKE2b-256 42475ad84744b67124490730753f558280195312e362a992d91beb7731d034f2

See more details on using hashes here.

File details

Details for the file password_entropy_meter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for password_entropy_meter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15cba5341479b5d3b24cd5047032fa1a4f65f19862e3f94f717c89f085456d0c
MD5 cd6432040e9340895b2fd01f055c7811
BLAKE2b-256 60abd070888994cca10128109ee71dfb63c71769a048a3d00ac15d5ea7e515cb

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