Quantum Locker

Published by strangeworks (10/08/2020)

Quantum Locker

It is well known that Grover's algorithm asymptotically transforms an equal superposition state into an eigenstate (of a given basis). Here, we demonstrate a verification algorithm based on weak measurement which can achieve the same purpose even if the qubit is not in an equal superposition state. The proposed algorithm highlights the distinguishability between any arbitrary single qubit superposition state and an eigenstate. We apply this algorithm to propose the scheme of a Quantum Locker, a protocol in which any legitimate party can verify his/her authenticity by using a newly developed quantum One-Time Password (OTP) and retrieve the necessary message from the locker. We formally explicate the working of quantum locker in association with the quantum OTP, which theoretically offers a much higher security against any adversary, as compared to any classical security device.


Verification Algorithm

This algorithm uses a verification box VV​ ([Fig. 1]) to discriminate two non-orthogonal states, i.e., ∣0⟩|0\rangle​, and a generic state ∣ϕ⟩≡α∣0⟩+β∣1⟩|\phi\rangle\equiv\alpha|0\rangle+\beta|1\rangle​. The proposed scheme is composed of several iterations of a weak measurement protocol, where an ancillary qubit ∣δL⟩|{\delta_L}\rangle (in the state ∣0⟩|0\rangle​) is weakly coupled to the system. After each iteration, a projective measurement is performed on the ancilla, which slightly perturbs the state of the system (∣ϕ⟩|\phi\rangle​). The evolution of the coupled system (∣ϕ⟩⊗∣δL⟩|\phi\rangle\otimes|{\delta_L}\rangle​) after each iteration is described by the following unitary operator UU​,

U=[Rz(θ)⊗I2][cos⁡θI4−Isin⁡θC0NOT12]U=[R_z(\theta)\otimes I_{2}][\cos\theta I_{4}-I\sin\theta C^0\text{NOT}_{12}]​​

where I2I_{2}​ and I4I_{4}​ denote identity matrices of order 2 and 4 respectively. Here, C0NOT12C^0\text{NOT}_{12}​ flips the target qubit only when the control qubit is in state ∣0⟩|0\rangle​. It is to be noted that the operator UU​ describing the evolution of the coupled system is simply the Controlled0−Rx(2θ)\text{Controlled}^0-R_x(2\theta)​ operation, where the operator Rx(2θ)R_x(2\theta)​ acts on the ancilla (target) qubit only if the system (control) qubit is in state ∣0⟩|0\rangle​. Here, θ\theta​ is a parameter intrinsic to the locker, which is an arbitrarily small value (θ→0\theta\rightarrow0​). At the end of the first iteration, the operator UU​ transforms the composite system ∣ϕ⟩∣δL⟩|\phi\rangle|{\delta_L}\rangle​ into the following state,

U∣ϕ⟩∣δL⟩≡(αcosθ∣0⟩+β∣1⟩)∣0⟩−αisin⁡θ∣0⟩∣1⟩U|\phi\rangle|\delta_L\rangle\equiv (\alpha cos\theta|0\rangle+\beta|1\rangle)|0\rangle-\alpha i\sin\theta|0\rangle|1\rangle​​

It can be verified that the operation Controlled0−Rx(2θ)\text{Controlled}^0-R_x(2\theta)​ can be implemented by using universal single qubit gates and CNOT gate, as shown by the following circuit ([Fig. 2]).

After the execution of the unitary transformation UU​, a projective measurement (in Z-basis) is performed on the ancillary qubit, resulting in outcomes ∣0⟩|0\rangle​ and ∣1⟩|1\rangle​ with probabilities p0p_0​ and p1p_1​ respectively.


p1=∣α∣2sin2θ≈∣α∣2θ2 p_1=|\alpha|^2sin^2\theta\approx|\alpha|^2\theta^2​​

In the limit θ→0\theta\rightarrow0​, the probability of obtaining the state ∣1⟩|1\rangle​ on measurement of the ancilla is negligible. Hence, assuming the outcome of the ancilla state to be ∣0⟩|0\rangle​, the state of the system collapses to

∣ϕ⟩=αcosθ∣0⟩+β∣1⟩∣α∣2cos2θ+∣β∣2|\phi\rangle=\frac{\alpha cos\theta|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2cos^2\theta+|\beta|^2}}​​

≈(αcosθ∣0⟩+β∣1⟩)(1−∣α∣2θ2)−12\approx (\alpha cos\theta|0\rangle+\beta|1\rangle)(1-|\alpha|^2\theta^2)^{-\frac{1}{2}}​​

≈(α(1−θ22)∣0⟩+β∣1⟩)(1+12∣α∣2θ2)\approx (\alpha(1-\frac{\theta^2}{2})|0\rangle+\beta|1\rangle)(1+\frac{1}{2}|\alpha|^2\theta^2)​​

=α(1−∣β∣2θ22)∣0⟩+β(1+∣α∣2θ22)∣1⟩= \alpha(1-\frac{|\beta|^2\theta^2}{2})|0\rangle+\beta(1+\frac{|\alpha|^2\theta^2}{2})|1\rangle​​

Evidently, after one iteration, the state of the system is perturbed. Denoting α′=α(1−∣β∣2θ22)\alpha'=\alpha(1-\frac{|\beta|^2\theta^2}{2})​ and β′=β(1+∣α∣2θ22)\beta'=\beta(1+\frac{|\alpha|^2\theta^2}{2})​, it is to be noted that ∣α′∣<∣α∣|\alpha'|<|\alpha|​, while ∣β′∣>∣β∣|\beta'|>|\beta|​, provided α\alpha​ and β\beta not equal to zero. The state of the system is weakly perturbed towards the Z-basis eigen state ∣1⟩|1\rangle​. If we repeat the unitary transformation UU​ on the composite system, followed by a measurement on the ancillary qubit, the probability of obtaining the ancilla in the state ∣1⟩|1\rangle​, will be p1′≈∣α′∣2θ2p'_1\approx|\alpha'|^2\theta^2​, which is less than p1p_1​. Hence, the state of the ancilla collapses to the state ∣0⟩|0\rangle​ with an even higher probability than the previous one. In this case, the state of the system ∣ϕ⟩|\phi\rangle​ is further perturbed towards the state ∣1⟩|1\rangle​. In other words, the co-efficient of the eigen state ∣1⟩|1\rangle​ in the superposition state of the system increases slightly in magnitude. If we repeat this protocol a large number of times (while assuming that the state ∣0⟩|0\rangle​ is obtained in each measurement), we will obtain the final state ∣ϕ⟩|\phi\rangle​ of the system (initially in the state α∣0⟩+β∣1⟩\alpha|0\rangle+\beta|1\rangle​) arbitrarily close to the Z-basis eigen state ∣1⟩|1\rangle​. Our assumption, that the state ∣0⟩|0\rangle​ is obtained after every measurement of the ancilla, is justifiable since θ\theta​ can take any arbitrary small value (θ→0\theta\rightarrow0​), such that the probability of getting ∣1⟩|1\rangle​ is also extremely small (having a θ2\theta^2​ dependence). Additionally, our assumption is greatly aided by the fact that the probability of obtaining the state ∣1⟩|1\rangle​ decreases with each iteration, since it has a ∣α∣2|\alpha|^2​ dependence, and ∣α∣|\alpha|​ decreases with each iteration.

It is evident that, after each iteration of the verification box, the state of the system does not change if it is initially in any of the zz​-basis eigenstates {∣0⟩,∣1⟩}\{|{0}\rangle,|1\rangle\}​. It can also be pointed out that the eigen states of the z-basis act as fixed points for the evolution protocol mentioned above, where ∣0⟩|0\rangle​ and ∣1⟩|1\rangle​ behave as unstable and stable fixed points respectively. However, if a generic superposition state α∣0⟩+β∣1⟩\alpha|0\rangle+\beta|1\rangle​ (α,β\alpha,\beta​ not equal to zero) is fed into our verification box, then the state of the system asymptotically approaches the stable fixed point ∣1⟩|1\rangle​. In this way, we can distinguish the eigenstate ∣0⟩|0\rangle​ from any arbitrary superposition state α∣0⟩+β∣1⟩\alpha|0\rangle+\beta|1\rangle​.

A single iteration of the standard Grover's algorithm rotates any arbitrary single qubit state ∣ψ⟩|\psi\rangle​ through an angle of π2\frac{\pi}{2}​ about the Z-axis, implying that the state transforms back to itself periodically after 4 iterations. Our verification algorithm uses an ancillary qubit, which is weakly coupled to the system qubit. It involves a repetitive series of coupling and decoupling of the ancilla (environment) with the system. Hence, some information about the state of the system is leaked to the environment. During the process, the coupling between the two qubits is followed by measurement of the ancilla in Z-basis, which results in collapsing the state of the ancilla to a Z-basis eigenstate (∣0⟩|0\rangle​) with high probability. Correspondingly, the state of the system is only weakly perturbed, towards the other eigenstate (∣1⟩|1\rangle​). This results in decoupling the system from the environment. The same procedure for coupling and decoupling is repeated a large number of times.

The coupling process takes place by means of the unitary transformation U≡Controlled0−Rx(2θ)U\equiv \text{Controlled}^0-R_x(2\theta)​. To preserve the eigenstate ∣0⟩|0\rangle​ and transform any other arbitrary state to the eigenstate ∣1⟩|1\rangle​, the Controlled0−Rx(2θ)\text{Controlled}^0-R_x(2\theta)​ operation is used. In a way, it prevents any information about the state of the system related to the eigenstate ∣0⟩|0\rangle​ from passing to the environment (ancilla). The operation UU​ is also equivalent to the operation [Rz⊗I]e−iC0NOT12θ[R_z\otimes I]e^{-iC^0\text{NOT}_{12}\theta}​, a conditional decay operation, which acts as an eigenstate amplifier, amplifying the eigenstate ∣1⟩|1\rangle​ in the superposition state ∣ψ⟩|\psi\rangle​.

Quantum Locker: Based on a Quantum OTP

Definition of a Quantum Locker and a Quantum OTP

Informally, the proposed scheme of a quantum locker consists of three stages,

* First stage, where a message and certain parameters, required for the verification of One Time Password (OTP), are fed into the locker. 

* Second stage, where a quantum OTP state is teleported to the intended receiver. 

* Third stage, where a protocol is presented for the verification of the OTP and transfer of the message.

Ideally, an OTP is expected to have the following properties,

* Verifiability, i.e., it can be verified by the locker.

* Unforgeability, i.e., an OTP can neither be counterfeited nor can it be used more than once to access the message stored in the locker. 

The Quantum Locker Scheme

For the purpose of brevity, two parties, Alice and Bob, are introduced to describe the scheme. Initially, they share a maximally entangled pair of qubits in the state, ∣00⟩+∣11⟩2\frac{|{00}\rangle+|{11}\rangle}{\sqrt{2}}​, which is to be used as the teleportation channel between the two. Alice stores a message along with an OTP in the locker, situated at a secure location accessible to both parties, so that Bob could access the message in the future. She then teleports the OTP to Bob, by using which he verifies his authenticity and retrieves the message from the locker.


It consists of mm​ qubits which store the message (named as message qubits), and one ancillary qubit, which are inaccessible to any outside party. The message qubits can be either ∣0⟩|0\rangle or ∣1⟩|1\rangle​. The mm​ qubit message is, therefore, an arbitrary string composed of ∣0⟩|0\rangle​s and ∣1⟩|1\rangle​s only. Let ∣aL(i)⟩|{a^{(i)}_L}\rangle​and ∣δL⟩|{\delta_L}\rangle​ denote the ithi^{th}​ message qubit and the ancillary qubit, in the locker respectively. The locker has an input slot through which any party may input the password qubit, as well as mm​ other input slots into which the party may place mm​ qubits in ∣0⟩|0\rangle​ state, meant for retrieving the message. In the whole scheme, it is assumed that Bob has the prior knowledge about the basis of the stored message qubits.

The Protocol

Storage of Message And Password

The mm​ message qubits in the locker are initially prepared in ∣0⟩|0\rangle​ state. Now, Alice encodes her message in the locker by applying X gates on the requisite message qubits, in order to make a binary string of ∣0⟩|0\rangle​s and ∣1⟩|1\rangle​s. This feature is provided by the locker itself. For reasons that have been stated in a later subsection, a string with all qubits in ∣0⟩|0\rangle​ state is not a valid message. Henceforth, for password purposes, Alice must randomly choose and input the values of θ1\theta_1​, θ2\theta_2​ and θ3\theta_3​ to the locker, where θ1\theta_1​, θ2\theta_2​, θ3\theta_3​  ϵ\epsilon[−π,π][-\pi, \pi]​. These values act as parameters for the rotation operator denoted by, R−1(θ1,θ2,θ3)R^{-1}(\theta_1,\theta_2,\theta_3)​, where R−1(θ1,θ2,θ3)=Rx(−θ1)Ry(−θ2)Rz(−θ3)R^{-1}(\theta_1,\theta_2,\theta_3)=R_x(-\theta_1)R_y(-\theta_2)R_z(-\theta_3)​.  

Generation of OTP State

Alice owns an ancilla qubit which is initially kept in ∣0⟩|0\rangle​ state. She is equipped with a portable device which can perform the operation, R(θ1,θ2,θ3)=Rz(θ3)Ry(θ2)Rx(θ1)R(\theta_1,\theta_2,\theta_3)=R_z(\theta_3)R_y(\theta_2)R_x(\theta_1)​, where θ1\theta_1​, θ2\theta_2​ and θ3\theta_3​ are the same parameters previously used as inputs to the locker. Since this device is portable, she can perform this operation anytime and anywhere at her will. Alice generates the OTP state denoted by, ∣ψ⟩|\psi\rangle​ by performing the above operation on her ancilla qubit, and sends it to Bob through the teleportation channel. 

Verification of OTP

For retrieving the message, Bob must store the teleported state, ∣ψ⟩|\psi\rangle​ in a qubit. The locker implements the operation R−1(θ1,θ2,θ3)R^{-1}(\theta_1,\theta_2,\theta_3)​ on this qubit to create a new state, represented by ∣ϕ⟩|\phi\rangle​. He also keeps mm​ qubits (named as blank qubits) possessing ∣0⟩|0\rangle​ state in the specified slots of the locker. For the purpose of verification, a verification box VV​ has been designed, the detailed working of which has already been discussed. The verification box VV​ acts on ∣ϕ⟩|\phi\rangle​ and produces two distinguishable results depending on whether the qubit entered by some party is in the state ∣ψ⟩|\psi\rangle​ (the state originally prepared by Alice) or not.

CASE I - Entering Correct Password:

In this case, the password entered into the locker is in the state ∣ψ⟩|\psi\rangle​. The operation of R−1(θ1,θ2,θ3)R^{-1}(\theta_1,\theta_2,\theta_3)​ on ∣ψ⟩|\psi\rangle​ yields ∣ϕ⟩≡∣0⟩|\phi\rangle\equiv|0\rangle​. The state does not change by applying the verification box VV​ on ∣ϕ⟩|\phi\rangle​ a large number of times.

CASE II - Entering Wrong Password:

In this case, the password entered into the locker is in a state ∣ψ′⟩|\psi'\rangle​, which is different from the state ∣ψ⟩|\psi\rangle​. The operation of R−1(θ1,θ2,θ3)R^{-1}(\theta_1,\theta_2,\theta_3)​ on ∣ψ′⟩|\psi'\rangle​ yields ∣ϕ⟩≡α∣0⟩+β∣1⟩|\phi\rangle\equiv\alpha|0\rangle+\beta|1\rangle​, where α\alpha​ and β\beta​are arbitrary complex numbers. In this case, after the operation of the verification box VV​ a large number of times, the state ∣ϕ⟩|\phi\rangle​ is transformed into the state ∣1⟩|1\rangle​, which can be distinguished from the state ∣0⟩|0\rangle​.

Transfer of Message

After the operation of the verification box VV​on ∣ϕ⟩|\phi\rangle​, a measurement is performed on this qubit (in Z-basis). To transfer the ithi^{th}​ message qubit ∣aL(i)⟩|{a^{(i)}_L}\rangle​ to theithi^{th}​ blank qubit ∣bL(i)⟩|{b^{(i)}_L}\rangle​, we use the circuit shown in [Fig. 3].

There are mm​ such Toffoli gates as used in [Fig. 3], where the first control qubit is the same (∣ϕ⟩|{\phi}\rangle​, following measurement) for all gates, while the second control and the target qubits of the ii​th Toffoli gate are in ∣aL(i)⟩|{a^{(i)}_L}\rangle​ and ∣bL(i)⟩|{b^{(i)}_L}\rangle​ states respectively. It can be easily seen that the measurement of ∣ϕ⟩|\phi\rangle​ gives the outcome ∣0⟩|0\rangle​ when the entered password is correct. Hence, ∣bL(i)⟩|{b^{(i)}_L}\rangle​ becomes ∣1⟩|1\rangle​ if ∣aL(i)⟩|{a^{(i)}_L}\rangle​ is in the state ∣1⟩|1\rangle​, otherwise it remains in the state ∣0⟩|0\rangle​. Thus, the information stored in the message qubits is transferred to the blank qubits entered into the locker by the party, which are now ready for retrieval.

For the case when the entered password is incorrect, measurement of ∣ϕ⟩|\phi\rangle​ following the verification box gives the outcome ∣1⟩|1\rangle​ with an arbitrarily high probability. Hence, none of the ∣bL(i)⟩|{b^{(i)}_L}\rangle​ is flipped, resulting in no transfer of information. This explains why ∣aL(i)⟩=∣0⟩|{a^{(i)}_L}\rangle=|0\rangle​ for all i is not a valid message- we consider this case as informationless.

Quantum Circuit

Code for demonstrating the working of the verification algorithm

from qiskit import QuantumCircuit, execute
from strangeworks.qiskit import get_backend
import numpy as np
import math

#take 2 quantum registers and 1 classical registers
qc = QuantumCircuit(2, 1)

#create a superposition state

# prepare the weak interaction protocol
qc.cx(0, 1)
qc.cx(0, 1)

#measure the q[1] qubit
qc.measure([1], [0])

# get a Strangeworks backend
backend = get_backend("qasm_simulator")

# execute circuit
execute(qc, backend, shots=1024)

Execution results

After executing the circuits on the Strangeworks platform, we can observe that, the ancilla qubit coverges towards state ∣0⟩|0\rangle​, and deviates from state ∣1⟩|1\rangle​after one iteration. The probabilities are found to be 95% and 5% respectively. Similary, after applying a large number of iterations, the ancilla qubit converges to ∣0⟩|0\rangle​ state.


To conclude, we have proposed here a verification algorithm, in a way that it takes an unequal superposition state and transforms it into an eigenstate. The algorithm also distinguishes any arbitrary superposition state from an eigenstate. We have introduced the concept of a locker based on the principles of quantum mechanics, which takes an arbitrarily generated quantum state as a password. The locker subsequently destroys the quantum information encoded in the password qubit(s) through the course of its operation. Hence, the password acts as a One-Time Password. We have presented a password verification protocol based on the principles of weak measurement. The working of the verification algorithm has been experimentally realized with a high fidelity.

In our discussed protocol, we have imagined the contents of the locker to be some form of a message encoded by the sender, composed of a certain number of qubits. The basic principles of our quantum locker scheme could be extended to various other applications. Instead of storing a message, one may consider storing some physical entity, as one may wish, which could be accessible to the intended retriever once the entered password has been verified by the locker.