Skip to main content

PwnedPwd

Have my passwords been compromised?

Latest Version

tests

License

Info

PwnedPwd is a tiny CLI tool which uses the online service Pwned Passwords to check whether a given password has been compromised in known data breaches. Credits to Troy Hunt for hosting such service.

How it works?

Given the input password, this tool will

  • hash it using SHA-1 algorithm, resulting in a 40-characters hexadecimal string
  • Use the first 5 characters from the generated string to query the online service
  • The online service returns a list of all matching hashes for the given prefix
  • Verify if your SHA-1 hash is present in the response

For instance, given an input password P@ssword

  • SHA-1 hash is 9E7C97801CB4CCE87B6C02F98291A6420E6400AD
  • The first 5 characters are 9E7C9
  • We query the online service using GET https://api.pwnedpasswords.com/range/9E7C9
  • The online service returns a list of all matching hashes (777 hashes for this example):
    ...
    77B1EE4BF1B49FEB288C7FC65EE604C0C54:24
    780087028CF36AF6A5A1DCF096748FB7090:10
    7801CB4CCE87B6C02F98291A6420E6400AD:10848
    782545129CEA7F3BD1A076F25B94C064CFE:3
    788872DE964354319100FCE0EF4DEA00311:4
    ...
    
  • We verify that 7801CB4CCE87B6C02F98291A6420E6400AD is present and have 10848 occurrences in data breaches

About Pwned Passwords

Extracted from their website:

Pwned Passwords are more than half a billion passwords which have previously been exposed in data breaches. The service is detailed in the launch blog post then further expanded on with the release of version 2. The entire data set is both downloadable and searchable online via the Pwned Passwords page. In order to protect the value of the source password being searched for, Pwned Passwords also implements a k-Anonymity model that allows a password to be searched for by partial hash.

Detailed information can be found

Installation

Using uv (recommended):

$ uv tool install pwnedpwd

Or run it without installing:

$ uvx pwnedpwd

Using pip:

$ pip install pwnedpwd

Usage

$ pwnedpwd
Password: ******
[GOOD] Password is not present in any known data breach. (source https://haveibeenpwned.com/Passwords)
$ pwnedpwd
Password: 12345
[BAD] Password appeared 2570791 times in data breaches. (source https://haveibeenpwned.com/Passwords)

Development

This project uses uv for dependency management, ruff for linting/formatting and mypy for type checking.

$ uv sync
$ uv run bash scripts/test.sh

Metadata

Release files for pwnedpwd 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pwnedpwd 0.2.0
File Size Uploaded Provenance Actions
pwnedpwd-0.2.0.tar.gz 53.9 kB Without provenance Details for pwnedpwd-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pwnedpwd 0.2.0
File Interpreter ABI Platform Actions
pwnedpwd-0.2.0-py3-none-any.whl Python 3 none any Details for pwnedpwd-0.2.0-py3-none-any.whl

Total release size: 58.5 kB

Release files / pwnedpwd-0.2.0.tar.gz

Download URL pwnedpwd-0.2.0.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c58790a699de1b0a624033fc1b7c5fb6ddba00d25b368f393566a26f3fec7901
BLAKE2b-256 checksum
How to use checksums
2865806e4ed220d8be4f90724e0dec0e815c066d1d04fbcaa6670d58e9a8a28a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pwnedpwd-0.2.0-py3-none-any.whl

Download URL pwnedpwd-0.2.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e65eb6d7ffbff1ea0ef80487a6180f640acb1cb0fac6a273301ff8718a9d2fa6
BLAKE2b-256 checksum
How to use checksums
36d2f6e8f5f5011138fef45c2961c47a6aeee0c7421e2a2c54e946d29c59b2c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pwnedpwd 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page