Simple CLI tool that checks if your password has been compromised.
Project description
Passchek
A privacy-first CLI tool for checking whether a password has appeared in known data breaches using Troy Hunt's Pwned Passwords API and the k-anonymity model.
Passchek securely checks passwords against the Have I Been Pwned Pwned Passwords API without ever sending the full password, or even the full SHA-1 hash, over the network.
The project is intentionally designed so that users can quickly audit the full source code themselves. Since real passwords and user trust are involved, the implementation follows strict engineering principles:
Design Principles
-
Conciseness The code stays as short as possible while preserving readability. No unnecessary layers, abstractions, or dead code.
-
Clarity A novice Python developer should be able to understand the whole program in under a minute. The structure is intentionally simple, PEP 8 compliant, and self-explanatory.
-
Leanness Every function, import, and constant must justify its existence. Anything non-essential is removed.
-
Embeddability The core breach-check logic is trivially reusable as a small importable function for CI/CD, scripts, web backends, or other automation.
-
Professional suitability The codebase follows production-grade engineering expectations: clear control flow, minimal side effects, strong typing, predictable behavior, robust error handling, and idiomatic Python.
-
Security Password exposure risk is minimized through hidden prompt input, reduced plaintext copies, no logging, no unnecessary I/O, local suffix matching, and careful hashing flow.
-
Independence Passchek uses only the Python standard library and targets Python 3.9+.
-
Speed Response parsing uses early exits, minimal allocations, efficient iteration, and reduced memory copies for the fastest possible standard-library implementation.
These principles make it easy for users to personally verify that the application behaves safely.
Features
- Secure password breach checks using the k-anonymity protocol
- Check single or multiple passwords
- Read passwords from stdin and shell pipes
- Numeric-only output for scripting
- SHA-1 prefix/suffix output without network access
- Fast early-exit response parsing
- Python 3.9 through 3.14 support
- Modern PyPI package installation
- Zero third-party runtime dependencies
How It Works
-
Hash the password with SHA-1
-
Split the hash into:
- first 5 characters as prefix
- remaining 35 characters as suffix
-
Send only the prefix to the API
-
Compare suffixes locally
-
Return the breach count
The full password never leaves the local machine.
Installation
From PyPI
python3 -m pip install --upgrade passchek
Or for the current user only:
python3 -m pip install --user passchek
Verify installation
passchek --version
Expected output:
Passchek v0.2.3
From source
git clone https://github.com/edyatl/passchek.git
cd passchek
python3 -m pip install .
Note: pip search is no longer supported by PyPI. Use pip show passchek or passchek --version instead.
Usage
Usage:
passchek [options] [PASSWORD ...]
Arguments:
PASSWORD One or more passwords to check.
If omitted, Passchek reads from prompt or stdin.
Options:
-h, --help Show help and exit
-n, --num-only Output only breach count numbers
-p, --pipe Read passwords from stdin / shell pipe
-s, --sha1 Print SHA-1 hash as prefix/suffix and exit
-v, --version Show Passchek version
Examples
Interactive prompt
$ passchek
Enter password:
This password has appeared 3912816 times in data breaches.
Numeric output only
$ passchek -n
Enter password:
3912816
SHA-1 tuple mode
$ passchek -s
Enter password:
('B1B37', '73A05C0ED0176787A4F1574FF0075F7521E')
Multiple passwords
$ passchek -n qwerty ytrewq qazwsx random_password
3912816
33338
505344
0
Pipe mode
$ cat passwords.txt | passchek -np
21
8
0
0
457
Security Notes
The safest way to use Passchek is interactive prompt mode:
passchek
This avoids shell history leakage and keeps input hidden.
Avoid passing real passwords as command-line arguments:
passchek my-secret-password
Shell history may store plaintext values.
Prefer:
- interactive prompt
- stdin pipe
- secret injection from secure automation environments
Windows
Install Python 3.9+ from:
https://www.python.org/downloads/windows/
Then install:
py -m pip install passchek
Run:
passchek
Changelog
v0.2.3 (2026-04-10)
A major refactoring and modernization release focused on maintainability, packaging, typing, and Python 3.14 readiness.
Added
- Python 3.9+ built-in generics support
- package-style versioning via
passchek._version.__version__ - improved MANIFEST and PyPI packaging flow
- better CLI version and help formatting
- comprehensive type hints in source and tests
- linter, formatter, and pre-commit configuration
Changed
- refactored
main()into smaller focused units - replaced legacy URL helpers with
_APIconstant and f-strings - optimized response parsing with
splitlines()andpartition() - early exit on first suffix match
- modernized packaging from
setup.pytopyproject.toml - improved SHA-1 handling with
usedforsecurity=True
Fixed
- corrected password whitespace stripping
- improved pipe newline handling
- better empty-password test behavior
- more robust urllib error handling
- consistent non-zero CLI exit codes
Contributing
Contributions are welcome.
Areas especially appreciated:
- security review
- performance review
- code simplification
- packaging improvements
- test coverage
Repository:
https://github.com/edyatl/passchek
Acknowledgements
Thanks to Troy Hunt for the Pwned Passwords API.
Thanks to James Ridgway for the original shell-script inspiration.
Author
Yevgeny Dyatlov
GitHub: https://github.com/edyatl
License
MIT License
Copyright (c) 2020-2026 Yevgeny Dyatlov
See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file passchek-0.2.3.tar.gz.
File metadata
- Download URL: passchek-0.2.3.tar.gz
- Upload date:
- Size: 155.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f12e9ef3ccd6843d8c9967d6f5dde567e7e59b8bb95ebc8772beb4bf431390b2
|
|
| MD5 |
73065188c5de16e0db38d67a450a2561
|
|
| BLAKE2b-256 |
de9f3f2b02bb7910d610975d70898467efe2c60fa3dc8416cf489c16713b56e7
|
Provenance
The following attestation bundles were made for passchek-0.2.3.tar.gz:
Publisher:
publish-to-pypi.yml on edyatl/passchek
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
passchek-0.2.3.tar.gz -
Subject digest:
f12e9ef3ccd6843d8c9967d6f5dde567e7e59b8bb95ebc8772beb4bf431390b2 - Sigstore transparency entry: 1275374948
- Sigstore integration time:
-
Permalink:
edyatl/passchek@138231ad5db5805abf6e357689765d166c1b4aa5 -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/edyatl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@138231ad5db5805abf6e357689765d166c1b4aa5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file passchek-0.2.3-py3-none-any.whl.
File metadata
- Download URL: passchek-0.2.3-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0fc71292f4acb425e1c4dcfce7c876650599c60da3c6be1b24160cc55dc63fb
|
|
| MD5 |
9c46d0b73af34e91d3af638fa4d4b178
|
|
| BLAKE2b-256 |
a61983f9c9f971feaf20ad292a3473b0a24660bda28607e60c569248ae9a8eb9
|
Provenance
The following attestation bundles were made for passchek-0.2.3-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on edyatl/passchek
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
passchek-0.2.3-py3-none-any.whl -
Subject digest:
d0fc71292f4acb425e1c4dcfce7c876650599c60da3c6be1b24160cc55dc63fb - Sigstore transparency entry: 1275374959
- Sigstore integration time:
-
Permalink:
edyatl/passchek@138231ad5db5805abf6e357689765d166c1b4aa5 -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/edyatl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@138231ad5db5805abf6e357689765d166c1b4aa5 -
Trigger Event:
push
-
Statement type: