Circuit Builder → BB84 Key Distribution → XOR Encryption
Apply Hadamard (H) gates to put qubits in superposition, then measure to collapse them into random classical bits. Click any gate slot to toggle H on/off. Qubits without H always measure |0〉; qubits with H measure |0〉 or |1〉 with equal probability.
Alice uses the random bits from Step 1 as her raw key material. She randomly selects a basis (rectilinear + or diagonal x) for each bit. Bob independently picks random bases to measure. After transmission, they publicly compare bases -- only bits where both chose the same basis are kept as the shared secret key.
The quantum-derived shared key encrypts a plaintext message using XOR cipher. Each bit of the message is XORed with the corresponding key bit (repeating the key as needed). The same operation decrypts, proving correctness.