Skip to main content

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

  1. Quantum Circuit: Creates a circuit with Hadamard gates on all qubits โ†’ perfect 50/50 superposition.
  2. Measurement: Collapses qubits to classical bits โ†’ true quantum randomness.
  3. Bitstream: Raw measurements are packed into 8-bit integers (0โ€“255).
  4. Rejection Sampling: Bytes outside the uniform range are discarded to eliminate modulo bias.
  5. Hardware Fallback: If a token is given but IBM hardware is unreachable, automatically uses the local Aer simulator.
  6. 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 definition
  • qiskit-aer โ€” local quantum simulator
  • qiskit-ibm-runtime โ€” real IBM Quantum hardware access
  • zxcvbn โ€” 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

qabpassgen-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

qabpassgen-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file qabpassgen-0.1.0.tar.gz.

File metadata

  • Download URL: qabpassgen-0.1.0.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

Hashes for qabpassgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f43096ca0bfc0a661fa58bea0b5c7a4673b023e7f9ca10c660b833e2ee678150
MD5 1a39b2b79f5e70570c6d8259bb486111
BLAKE2b-256 43ff19eb8e6fe5411beb583a016af0a9e144d7acc8571852384c9d34378cf474

See more details on using hashes here.

Provenance

The following attestation bundles were made for qabpassgen-0.1.0.tar.gz:

Publisher: publish.yml on AdilDyer/qabpassgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qabpassgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qabpassgen-0.1.0-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

Hashes for qabpassgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 877dc8ffb4058628ed2b912921c80b085c15c8be4566f943f6e2fef9fbbee8ed
MD5 1eb2e67585e8adc66647c7f6f1248d31
BLAKE2b-256 ad4761e02f48586bd4a9d61f616d1ef2b7558aedb649b1b872fe75ba5a44f343

See more details on using hashes here.

Provenance

The following attestation bundles were made for qabpassgen-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AdilDyer/qabpassgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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