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.1.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.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

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

Hashes for qabpassgen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c84cc4f03c19ad9fb794f2654bc84a15b9d3be250aebb68c5db1634f4955ab70
MD5 60ff5c36dc58b4855b7f897ee91fb393
BLAKE2b-256 a235fbafdc99bbeeb563482a9d228bdd9ff2db975ec0762fb2264b8f21a90fca

See more details on using hashes here.

Provenance

The following attestation bundles were made for qabpassgen-0.1.1.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.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

Hashes for qabpassgen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 118d4936dcf5c8a63479ae8fdc6a7ccd075f1899abd68c50cc85aecece6d3f6f
MD5 405c1f21d47300bb13412bc49d25d1e8
BLAKE2b-256 5aadcbf43865f044c354f01e76f25869db62a5d1e8bbad3bfd6d5025d486be12

See more details on using hashes here.

Provenance

The following attestation bundles were made for qabpassgen-0.1.1-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