Quantum password generator using IBM Quantum hardware or Aer simulator
Project description
QabPassGen ๐โ๏ธ
Quantum-Entropy Password Generator โ powered by real IBM Quantum hardware or local Aer simulation.
qabpassgen generates cryptographically strong passwords using true quantum randomness. It applies Hadamard gates to put qubits into superposition, measures their collapse, and converts the resulting bitstream into passwords via rejection sampling (eliminating modulo bias). Password strength is then verified by zxcvbn.
๐ฆ Installation
pip install qabpassgen
Note: Requires Python >=3.9, <3.13
๐ Usage
Minimal โ Simulator (no token needed)
import qabpassgen
result = qabpassgen.generate_password()
print(result['password'])
# Example: "X7kPq2mNvLz!8Yw3A#m"
With all options
import qabpassgen
result = qabpassgen.generate_password(
ibm_token="YOUR_IBM_QUANTUM_TOKEN", # Optional: use real hardware
length=32,
use_symbols=True,
use_numbers=True
)
print(result['password'])
Pretty terminal report
import qabpassgen
result = qabpassgen.generate_password(length=24, use_symbols=True, use_numbers=True)
qabpassgen.print_report(result)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ QUANTUM ENTROPY AUDIT โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ PASS: X7#kPq@2mNvLz!8Yw3A#m โ
โ RANK: 4/4 Security Score โ
โ TIME: centuries โ
โ BITS: 87.3 Shannon Entropy โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโข
โ FROM: Aer_Quantum_Sim โ
โ UTIL: 96.1% Yield Efficiency โ
โ LOAD: 0.312s โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ API Reference
generate_password(...) โ dict
| Parameter | Type | Default | Description |
|---|---|---|---|
ibm_token |
str |
None |
IBM Quantum API token. Uses real hardware if provided; falls back to Aer simulator if omitted or if hardware is offline. |
length |
int |
20 |
Number of characters in the password. |
use_symbols |
bool |
True |
Include symbols: !@#$%^&* |
use_numbers |
bool |
True |
Include digits 0โ9 |
Returns a dict:
{
"password": "X7#kPq@2mNvLz!8Yw3A#m",
"metrics": {
"strength": "4/4", # zxcvbn score
"crack_time": "centuries", # estimated offline crack time
"entropy": 87.3 # Shannon entropy in bits
},
"provenance": {
"source": "Aer_Quantum_Sim", # or real IBM device name e.g. "ibm_kyiv"
"bits": 1920, # total quantum bits consumed
"yield": "96.1%", # rejection sampling efficiency
"latency": "0.312s" # total generation time
}
}
print_report(result)
Renders a formatted terminal report. Pass the dict returned by generate_password().
qabpassgen.print_report(result)
๐ง How It Works
- Quantum Circuit: Creates a circuit with Hadamard gates on all qubits โ perfect 50/50 superposition.
- Measurement: Collapses qubits to classical bits โ true quantum randomness.
- Bitstream: Raw measurements are packed into 8-bit integers (0โ255).
- Rejection Sampling: Bytes outside the uniform range are discarded to eliminate modulo bias.
- Hardware Fallback: If a token is given but IBM hardware is unreachable, automatically uses the local Aer simulator.
- Strength Check: Result is validated with
zxcvbn.
๐ IBM Quantum Token
To use real quantum hardware, get a free token at quantum.ibm.com and pass it as ibm_token. Without a token, the local Aer simulator is used automatically.
You can also set it via environment variable:
export IBM_QUANTUM_TOKEN="your_token_here"
import os, qabpassgen
result = qabpassgen.generate_password(ibm_token=os.getenv("IBM_QUANTUM_TOKEN"))
๐ก๏ธ Dependencies
qiskitโ quantum circuit definitionqiskit-aerโ local quantum simulatorqiskit-ibm-runtimeโ real IBM Quantum hardware accesszxcvbnโ password strength estimation
๐ License
MIT License โ see LICENSE for details.
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
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 qabpassgen-0.1.1.tar.gz.
File metadata
- Download URL: qabpassgen-0.1.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c84cc4f03c19ad9fb794f2654bc84a15b9d3be250aebb68c5db1634f4955ab70
|
|
| MD5 |
60ff5c36dc58b4855b7f897ee91fb393
|
|
| BLAKE2b-256 |
a235fbafdc99bbeeb563482a9d228bdd9ff2db975ec0762fb2264b8f21a90fca
|
Provenance
The following attestation bundles were made for qabpassgen-0.1.1.tar.gz:
Publisher:
publish.yml on AdilDyer/qabpassgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qabpassgen-0.1.1.tar.gz -
Subject digest:
c84cc4f03c19ad9fb794f2654bc84a15b9d3be250aebb68c5db1634f4955ab70 - Sigstore transparency entry: 1623967761
- Sigstore integration time:
-
Permalink:
AdilDyer/qabpassgen@79fe242494018dc212ece690c73444aa0abed1cb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AdilDyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79fe242494018dc212ece690c73444aa0abed1cb -
Trigger Event:
release
-
Statement type:
File details
Details for the file qabpassgen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: qabpassgen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.9 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 |
118d4936dcf5c8a63479ae8fdc6a7ccd075f1899abd68c50cc85aecece6d3f6f
|
|
| MD5 |
405c1f21d47300bb13412bc49d25d1e8
|
|
| BLAKE2b-256 |
5aadcbf43865f044c354f01e76f25869db62a5d1e8bbad3bfd6d5025d486be12
|
Provenance
The following attestation bundles were made for qabpassgen-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on AdilDyer/qabpassgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qabpassgen-0.1.1-py3-none-any.whl -
Subject digest:
118d4936dcf5c8a63479ae8fdc6a7ccd075f1899abd68c50cc85aecece6d3f6f - Sigstore transparency entry: 1623967763
- Sigstore integration time:
-
Permalink:
AdilDyer/qabpassgen@79fe242494018dc212ece690c73444aa0abed1cb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AdilDyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79fe242494018dc212ece690c73444aa0abed1cb -
Trigger Event:
release
-
Statement type: