πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Quantum Cryptography

Quantum ComputingQuantum Cryptography🟒 Free Lesson

Advertisement

Quantum Key Distribution

Quantum key distribution (QKD) uses quantum mechanics to establish a shared secret key between two parties with information-theoretic security. Unlike classical cryptography, security is guaranteed by the laws of physics, not computational assumptions.

The key insight is that measuring a quantum state disturbs it β€” an eavesdropper introduces detectable errors.

BB84 Protocol

The BB84 protocol (Bennett & Brassard, 1984) uses two conjugate bases:

Alice's encoding:

  • Bit 0: (Z-basis) or (X-basis)
  • Bit 1: (Z-basis) or (X-basis)

Protocol steps:

  1. Alice sends qubits in random bases
  2. Bob measures in random bases
  3. They publicly compare bases (not results)
  4. Keep only matching-basis rounds -> sifted key
  5. Estimate error rate from public subset
  6. If error rate < threshold, perform error correction and privacy amplification

Security: If Eve intercepts, she introduces error rate >= 25% for random intercept-resend.

E91 Protocol

The E91 protocol (Ekert, 1991) uses entanglement and Bell's inequality for security:

  1. Source produces Bell pairs and sends one qubit to each party
  2. Alice and Bob measure in random bases
  3. Correlated measurements (same basis) form the raw key
  4. Uncorrelated measurements test Bell's inequality

Security is verified by violating the CHSH inequality:

Any eavesdropping reduces the violation below the quantum maximum .

Post-Quantum Cryptography

Post-quantum cryptography (PQC) refers to classical algorithms believed to be secure against quantum attacks. NIST has standardized several PQC algorithms:

AlgorithmTypeSecurity Basis
ML-KEM (CRYSTALS-Kyber)Key encapsulationModule LWE
ML-DSA (CRYSTALS-Dilithium)Digital signatureModule LWE
SLH-DSA (SPHINCS+)Digital signatureHash functions
FN-DSA (FALCON)Digital signatureNTRU lattices

These rely on the hardness of lattice problems, hash functions, or coding theory.

Quantum Random Number Generation

QRNG produces certifiably random numbers using quantum measurement:

where is the minimum entropy of the quantum source.

Vacuum fluctuation QRNG: measure vacuum noise with homodyne detection Device-independent QRNG: certify randomness from Bell violations

QRNGs are commercially available and used in QKD systems for key generation.

Quantum-Safe Migration

Organizations must prepare for the quantum threat:

  1. Inventory: catalog all cryptographic assets
  2. Assess: determine quantum vulnerability
  3. Prioritize: critical data with long sensitivity lifetime
  4. Migrate: transition to PQC algorithms
  5. Hybrid: use both classical and PQC during transition

The harvest now, decrypt later threat means encrypted data intercepted today may be decrypted by future quantum computers.

Python: BB84 Simulation

import numpy as np

def bb84_simulation(n=100, eve=False):
    # Simulate BB84 QKD protocol.
    np.random.seed(42)
    alice_bits = np.random.randint(0, 2, n)
    alice_bases = np.random.randint(0, 2, n)
    bob_bases = np.random.randint(0, 2, n)

    if eve:
        eve_bases = np.random.randint(0, 2, n)
        for i in range(n):
            if eve_bases[i] != alice_bases[i]:
                alice_bits[i] = np.random.randint(0, 2)

    bob_bits = np.zeros(n, dtype=int)
    for i in range(n):
        if bob_bases[i] == alice_bases[i]:
            bob_bits[i] = alice_bits[i]
        else:
            bob_bits[i] = np.random.randint(0, 2)

    sifted = alice_bases == bob_bases
    alice_key = alice_bits[sifted]
    bob_key = bob_bits[sifted]
    errors = np.sum(alice_key != bob_key) / len(alice_key)
    return errors, len(alice_key)

err_no_eve, key_len = bb84_simulation(n=1000, eve=False)
print(f"No Eve: error={err_no_eve:.3f}, key_len={key_len}")

err_eve, key_len = bb84_simulation(n=1000, eve=True)
print(f"With Eve: error={err_eve:.3f}, key_len={key_len}")

This simulates BB84 and shows how eavesdropping increases the error rate.

Need Expert Quantum Computing Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement