1 Introduction

Since the first quantum key distribution protocol (BB84) was presented by Bennett and Brassard [1] in 1984, a lot of quantum cryptographic protocols have been presented to solve various secure problems, for example, quantum key distribution (QKD) [110], quantum secure multiparty computation (QSMC) [1115], quantum secret sharing (QSS) [1619], quantum secure direction communication (QSDC) [2027], quantum teleportation (QT) [28, 29], quantum oblivious transfer (QOT) [3032], quantum coin-flipping (QCF) [33], and so on.

In recent years, quantum private comparison (QPC) has become an important branch of quantum cryptography. And many protocols about QPC have been proposed. Yang et al. [34] proposed the first QPC protocol utilizing Einstein–Podolsky–Rosen (EPR) pairs. Later, Chen et al. [35] presented an efficient protocol for QPC protocol using the triplet entangled state and single-particle measurement. Liu et al. [3639] designed four different QPC protocols based on the triplet entangled W states, Bell entangled states, χ-type genuine four-particle entangled states and GHZ entangled states, respectively. Certainly, there are many correlative protocols based on other different states, such as [4045]. These protocols all included a third party.

Therefore, following some ideas in Refs. [3445], an efficient QPC protocol utilizing four-particle entangled W state and Bell Entangled States is proposed. The protocol can enable two parties to compare the equality of their information and preserve their respective private inputs. The four-particle entangled W state is \(\vert W \rangle = \frac{1}{2} ( \vert 0001 \rangle + \vert 0010 \rangle + \vert 0100 \rangle + \vert 1000 \rangle )\) and Bell Entangled States is \(\vert \varPhi^{ +} \rangle = \frac{1}{\sqrt{2}} ( \vert 00 \rangle + \vert 11 \rangle )\). In the protocol, two parties could compare two bits of information in every round and no party needs unitary operations. Similar to Refs. [3445], the protocol includes a semi-honest third party, i.e., TP. The role of TP is to perform the protocol loyally and record all the results of its intermediate computations. It can only help two parties to get whether their private information are equal or not and cannot learn anything about the private information. And the idea of the block transmission method is used to send qubits in a batch by batch way in our protocol, which was presented in [21].

The rest of this paper is organized as follows: in Sect. 2, an efficient QPC protocol for the private comparison of equal information is described in detail. Then the correctness and security of the protocol are analyzed in Sect. 3. Finally, a brief discussion and summary are given in Sect. 4.

2 The Quantum Private Comparison of Equal Information

Before describing this protocol, we show the basic principle of four-particle entangled W state and Bell Entangled States swapping. We consider the case that one state is \(\vert W \rangle_{1234} = \frac{1}{2} ( \vert 0001 \rangle + \vert 0010 \rangle + \vert 0100 \rangle + \vert 1000 \rangle )\), the other state is \(\vert \varPhi^{ +} \rangle_{56} = \frac{1}{\sqrt{2}} ( \vert 00 \rangle + \vert 11 \rangle )\), if particles 1, 3 are measured with Bell basis, the state of the whole system evolves as follows:

$$\begin{aligned} &\vert W \rangle_{1234} \otimes \big\vert \varPhi^{ +} \big\rangle _{56} \\ &\quad= \frac{1}{2} \bigl( \big\vert \varPhi^{ +} \big\rangle _{12}\vert \varPsi^{ +} \rangle_{34}\big\vert \varPhi^{ +} \rangle_{56} + \big\vert \varPsi^{ +} \big\rangle _{12}\big\lvert \varPhi^{ +} \big\rangle _{34}\big\vert \varPhi^{ +} \big\rangle _{56} + \big\vert \varPhi^{ -} \big\rangle _{12}\big\vert \varPsi^{ +} \big\rangle _{34}\big\vert \varPhi^{ +} \big\rangle _{56} \\ &\qquad{} + \big\vert \varPsi^{ -} \big\rangle _{12}\big\vert \varPhi^{ +} \big\rangle _{34}\big\vert \varPhi^{ +} \big\rangle _{56} \bigr) \\ &\quad= \frac{1}{4}\bigl[\big\vert \varPhi^{ +} \big\rangle _{12} \bigl( \big\vert \varPhi^{ +} \big\rangle _{35} \big\vert \varPsi^{ +} \big\rangle _{46} + \big\vert \varPhi^{ -} \big\rangle _{35}\big\vert \varPsi^{ -} \big\rangle _{46} + \big\vert \varPsi^{ +} \big\rangle _{35} \big\vert \varPhi^{ +} \big\rangle _{46} + \big\vert \varPsi^{ -} \big\rangle _{35}\big\vert \varPhi^{ -} \big\rangle _{46} \bigr) \\ &\qquad{}+ \big\vert \varPsi^{ +} \big\rangle _{12} \bigl( \big\vert \varPhi^{ +} \big\rangle _{35}\big\vert \varPhi^{ +} \big\rangle _{46} + \big\vert \varPhi^{ -} \big\rangle _{35} \big\vert \varPhi^{ -} \big\rangle _{46} + \big\vert \varPsi^{ +} \big\rangle _{35}\big\vert \varPsi^{ +} \big\rangle _{46} + \big\vert \varPsi^{ -} \big\rangle _{35} \big\vert \varPsi^{ -} \big\rangle _{46} \bigr) \\ &\qquad{}+ \big\vert \varPhi^{ -} \big\rangle _{12} \bigl( \big\vert \varPhi^{ +} \big\rangle _{35}\big\vert \varPsi^{ +} \big\rangle _{46} + \big\vert \varPhi^{ -} \big\rangle _{35} \big\vert \varPsi^{ -} \big\rangle _{46} + \big\vert \varPsi^{ +} \big\rangle _{35}\big\vert \varPhi^{ +} \big\rangle _{46} + \big\vert \varPsi^{ -} \big\rangle _{35} \big\vert \varPhi^{ -} \big\rangle _{46} \bigr) \\ &\qquad{}+ \big\vert \varPsi^{ -} \big\rangle _{12} \bigl( \big\vert \varPhi^{ +} \big\rangle _{35}\big\vert \varPhi^{ +} \big\rangle _{46} + \big\vert \varPhi^{ -} \big\rangle _{35} \big\vert \varPhi^{ -} \big\rangle _{46} + \big\vert \varPsi^{ +} \big\rangle _{35}\big\vert \varPsi^{ +} \big\rangle _{46} + \big\vert \varPsi^{ -} \big\rangle _{35} \big\vert \varPsi^{ -} \big\rangle _{46} \bigr)\bigr] \end{aligned}$$
(1)

where \(\vert \varPhi^{ +} \rangle = \frac{1}{\sqrt{2}} ( \vert 00 \rangle + \vert 11 \rangle )\), \(\vert \varPhi^{ -} \rangle = \frac{1}{\sqrt{2}} ( \vert 00 \rangle - \vert 11 \rangle )\), \(\vert \varPsi^{ +} \rangle = \frac{1}{\sqrt{2}} ( \vert 01 \rangle + \vert 10 \rangle )\), \(\vert \varPsi^{ -} \rangle = \frac{1}{\sqrt{2}} ( \vert 01 \rangle - \vert 10 \rangle )\).

The protocol for quantum private comparison is described as follow:

Input::

Alice has a private information X, Bob has a private information Y. The binary representations of X and Y in \(F_{2^{L}}\) are (x 0,x 1,…,x L−1) and (y 0,y 1,…,y L−1), where x j ,y j ∈{0,1}, \(X = \sum_{j = 0}^{L - 1} x_{j}2^{j}\), \(Y = \sum_{j = 0}^{L - 1} y_{j}2^{j}\), j=0,…,L−1;2L−1≤max{x,y}≤2L.

Output::

Alice and Bob get X=Y or XY.

A semi-honest third party: Calvin.

Supposed that two parties, Alice and Calvin, use a QKD protocol to establish a common secret key K AC and two parties, Bob and Calvin, use a QKD protocol to establish a common secret keyK BC .

(1) Alice (Bob) divides her (his) binary representation of X(Y) into \(\lceil \frac{L}{2} \rceil\) groups \(G_{A}^{1}, G_{A}^{2}, \ldots, G_{A}^{ \lceil \frac{L}{2} \rceil} (G_{B}^{1}, G_{B}^{2}, \ldots, G_{B}^{ \lceil \frac{L}{2} \rceil} )\). Each group \(G_{A}^{j}(G_{B}^{j})\) (\(j = 0, \ldots, \lceil \frac{L}{2} \rceil\)) includes two binary bits in X(Y). If L mod 2=1, Alice (Bob) adds one 0 into the last group \(G_{A}^{ \lceil \frac{L}{2} \rceil} (G_{B}^{ \lceil \frac{L}{2} \rceil} )\).

(2) Alice prepares an ordered \(\lceil \frac{L}{2} \rceil\) four-particle sequence in four-particle entangled W state

$$ \vert W \rangle = \frac{1}{2} \bigl( \vert 0001 \rangle + \vert 0010 \rangle + \vert 0100 \rangle + \vert 1000 \rangle \bigr) $$
(2)

We denote the \(\lceil \frac{L}{2} \rceil\) four-particle sequence prepared by Alice with

$$ \bigl[ P_{A_{1}}^{1}P_{A_{2}}^{1}P_{B_{1}}^{1}P_{C_{1}}^{1}, P_{A_{1}}^{2}P_{A_{2}}^{2}P_{B_{1}}^{2}P_{C_{1}}^{2}, \ldots, P_{A_{1}}^{ \lceil \frac{L}{2} \rceil} P_{A_{2}}^{ \lceil \frac{L}{2} \rceil} P_{B_{1}}^{ \lceil \frac{L}{2} \rceil} P_{C_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(3)

(hereafter called sequence S A ), where the A 1,A 2,B 1,C 1 represent four particles in one four-particle entangled W state of Alice and the superscripts \(1, 2, \ldots, \lceil \frac{L}{2} \rceil\) indicate the four-particle entangled W state in the sequence of Alice.

Alice divides the sequence S A into three sequences. She takes particle A 1,A 2 from each state in S A to form an ordered particle sequence:

$$ \bigl[ P_{A_{1}}^{1}P_{A_{2}}^{1}, P_{A_{1}}^{2}P_{A_{2}}^{2}, \ldots, P_{A_{1}}^{ \lceil \frac{L}{2} \rceil} P_{A_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(4)

which is called \(S_{A_{1}}\).

She takes particle B 1 from each state in S A to form an ordered particle sequence:

$$ \bigl[ P_{B_{1}}^{1}, P_{B_{1}}^{2}, \ldots, P_{B_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(5)

which is called \(S_{B_{1}}\).

The remaining particles inS A

$$ \bigl[ P_{C_{1}}^{1}, P_{C_{1}}^{2}, \ldots, P_{C_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(6)

which is called \(S_{C_{1}}\).

Bob prepares an ordered \(\lceil \frac{L}{2} \rceil\) EPR pairs sequence in Bell state

$$ \big\vert \varPhi^{ +} \big\rangle = \frac{1}{\sqrt{2}} \bigl( \vert 00 \rangle + \vert 11 \rangle \bigr) $$
(7)

We denote the \(\lceil \frac{L}{2} \rceil\) EPR pairs sequence prepared by Bob with

$$ \bigl[ P_{B_{2}}^{1}P_{C_{2}}^{1}, P_{B_{2}}^{2}P_{C_{2}}^{2}, \ldots, P_{B_{2}}^{ \lceil \frac{L}{2} \rceil} P_{C_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(8)

(hereafter called sequence S B ), where the B 2,C 2 represent two particles in one Bell state of Bob and the superscripts \(1, 2, \ldots, \lceil \frac{L}{2} \rceil\) indicate the Bell State in the sequence of Bob.

Bob divides the sequence S B into two sequences. He takes particle B 2 from each state in S B to form an ordered particle sequence:

$$ \bigl[ P_{B_{2}}^{1}, P_{B_{2}}^{2}, \ldots, P_{B_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(9)

which is called \(S_{B_{2}}\).

The remaining particles in S B

$$ \bigl[ P_{C_{2}}^{1}, P_{C_{2}}^{2}, \ldots, P_{C_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(10)

which is called \(S_{C_{2}}\).

(3) Alice prepares an ordered L′ EPR pairs sequence in Bell state

$$ \vert \varPsi^{ +} \rangle = \frac{1}{\sqrt{2}} \bigl( \vert 01 \rangle + \vert 10 \rangle \bigr) $$
(11)

We denote the L′ EPR pairs sequence prepared by Alice with

$$ \bigl[ P_{B'_{1}}^{1}P_{C'_{1}}^{1}, P_{B'_{1}}^{2}P_{C'_{1}}^{2}, \ldots, P_{B'_{1}}^{ \lceil \frac{L}{2} \rceil} P_{C'_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(12)

(hereafter called sequence \(S'_{A}\)), where the \(B'_{1},C'_{1}\) represent two particles in one Bell state of Alice and the superscripts 1,2,…,L′ indicate the Bell State in the sequence of Alice.

Alice divides the sequence \(S'_{A}\) into two sequences. She takes particle \(B'_{1}\) from each state in \(S'_{A}\) to form an ordered particle sequence:

$$ \bigl[ P_{B'_{1}}^{1}, P_{B'_{1}}^{2}, \ldots, P_{B'_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(13)

which is called \(S_{B'_{1}}\).

The remaining particles in \(S'_{A}\)

$$ \bigl[ P_{C'_{1}}^{1}, P_{C'_{1}}^{2}, \ldots, P_{C'_{1}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(14)

which is called \(S_{C'_{1}}\)

Bob prepares an ordered L′ EPR pairs sequence in Bell state

$$ \vert \varPhi^{ +} \rangle = \frac{1}{\sqrt{2}} \bigl( \vert 00 \rangle + \vert 11 \rangle \bigr) $$
(15)

We denote the L′ EPR pairs sequence prepared by Bob with

$$ \bigl[ P_{B'_{2}}^{1}P_{C'_{2}}^{1}, P_{B'_{2}}^{2}P_{C'_{2}}^{2}, \ldots, P_{B'_{2}}^{ \lceil \frac{L}{2} \rceil} P_{C'_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(16)

(hereafter called sequence \(S'_{B}\)), where the \(B'_{2},C'_{2}\) represent two particles in one Bell state of Bob and the superscripts 1,2,…,L′ indicate the Bell State in the sequence of Bob.

Bob divides the sequence \(S'_{B}\) into two sequences. He takes particle \(B'_{2}\) from each state in \(S'_{B}\) to form an ordered particle sequence:

$$ \bigl[ P_{B'_{2}}^{1}, P_{B'_{2}}^{2}, \ldots, P_{B'_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(17)

which is called \(S_{B'_{2}}\).

The remaining particles in \(S'_{B}\)

$$ \bigl[ P_{C'_{2}}^{1}, P_{C'_{2}}^{2}, \ldots, P_{C'_{2}}^{ \lceil \frac{L}{2} \rceil} \bigr] $$
(18)

which is called \(S_{C'_{2}}\).

Alice inserts every particle in sequence \(S_{B'_{1}}(S_{C'_{1}})\) into sequence \(S_{B_{1}}(S_{C_{1}})\) and gets a new sequence \(S_{B_{1}^{*}}(S_{C_{1}^{*}})\). The sequence of insert positions is denoted by S q . Alice sends \(S_{B_{1}^{*}}\) to Bob and sends \(S_{C_{1}^{*}}\) to Calvin. After Bob gets the \(S_{B_{1}^{*}}\) and Calvin gets the \(S_{C_{1}^{*}}\), Alice sends S q to Bob.

Bob inserts every particle in sequence \(S_{B'_{2}}(S_{C'_{2}})\) into sequence \(S_{B_{2}}(S_{C_{2}})\) according to S q and gets a new sequence \(S_{B_{2}^{*}}(S_{C_{2}^{*}})\). Then Bob sends \(S_{C_{2}^{*}}\) to Calvin.

(4) After receiving \(S_{B_{1}^{*}},S_{C_{1}^{*}}\) and \(S_{C_{2}^{*}}\), Bob and Calvin check whether there is any eavesdropper in the channel by the following procedure: (a) Bob sends S q to Calvin. (b) Bob (Calvin) chooses L′ two particles from the sequence \(S_{B_{1}^{*}}S_{B_{2}^{*}}(S_{C_{1}^{*}}S_{C_{2}^{*}})\) according to S q . (c) Bob (Calvin) chooses the basis σ z to make two particles measurement. If no eavesdropping exists, the results of Bob and Calvin should be one of the following four results, 10 and 00, 11 and 01, 00 and 10, 01 and 11. Bob and Calvin can find the existence of an eavesdropper by a predetermined threshold of error rate according to their measuring results. If the error rate exceeds the threshold they preset, they abort the scheme. Otherwise, they continue to the next step.

(5) Bob and Calvin discard the particles in \(S_{B_{1}^{*}}\), \(S_{B_{2}^{*}}\), \(S_{C_{1}^{*}}\), \(S_{C_{2}^{*}}\) which are used to check the eavesdroppers. There are two sequences owned by Bob which are denoted by [\(P_{B_{1}}^{1}, P_{B_{1}}^{2}, \ldots, P_{B_{1}}^{ \lceil \frac{L}{2} \rceil}\) ], [\(P_{B_{2}}^{1}, P_{B_{2}}^{2}, \ldots, P_{B_{2}}^{ \lceil \frac{L}{2} \rceil}\) ]; there are two sequences owned by Calvin which are denoted by [\(P_{C_{1}}^{1}, P_{C_{1}}^{2}, \ldots, P_{C_{1}}^{ \lceil \frac{L}{2} \rceil}\) ], [\(P_{C_{2}}^{1}, P_{C_{2}}^{2}, \ldots, P_{C_{2}}^{ \lceil \frac{L}{2} \rceil}\) ].

For \(j = 1, 2, \ldots, \lceil \frac{L}{2} \rceil\):

(5.1) Alice uses Bell basis to measure two particles \(P_{A_{1}}^{j}P_{A_{2}}^{j}\) in \(S_{A_{1}}\), We denote the outcome of Alice ’s measurement with \(M_{j}^{A}\). If \(M_{j}^{A} = \vert \varPhi^{ \pm} \rangle\), then \(R_{j}^{A} = 10; M_{j}^{A} = \vert \varPsi^{ \pm} \rangle\), then \(R_{j}^{A} = 00\).

(5.2) Bob uses Bell basis to measure two particles \(P_{B_{1}}^{j}P_{B_{2}}^{j}\) in \(S_{B_{1}}S_{B_{2}}\), We denote the collapsed Bell state of Bob with \(M_{j}^{B}\). If \(M_{j}^{B} = \vert \varPhi^{ +} \rangle\), then \(R_{j}^{B} = 00; M_{j}^{B} = \vert \varPhi^{ -} \rangle\), then \(R_{j}^{B} = 01; M_{j}^{B} = \vert \varPsi^{ +} \rangle\), then \(R_{j}^{B} = 10; M_{j}^{B} = \vert \varPsi^{ -} \rangle\), then \(R_{j}^{B} = 11\).

(5.3) Alice (Bob) calculates \(R_{j}^{A'} = R_{j}^{A} \oplus G_{j}^{A}(R_{j}^{B'} = R_{j}^{B} \oplus G_{j}^{B})\)

(6) Alice and Bob uses classic one time pad and K AC (K BC ) to encrypt the binary sequence \(R_{1}^{A'}, R_{2}^{A'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{A'}(R_{1}^{B'}, R_{2}^{B'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{B'})\) and sends \(E_{K_{AC}}(R_{1}^{A'}), E_{K_{AC}}(R_{2}^{A'}), \ldots, E_{K_{AC}}(R_{ \lceil \frac{L}{2} \rceil}^{A'}) (E_{K_{BC}}(R_{1}^{B'}), E_{K_{BC}}(R_{2}^{B'}), \ldots, E_{K_{BC}}(R_{ \lceil \frac{L}{2} \rceil}^{B'}))\) to Calvin.

(7) After receiving two sequences, Calvin uses K AC (K BC ) to decrypt \(E_{K_{AC}}(R_{1}^{A'}), E_{K_{AC}}(R_{2}^{A'}), \ldots, E_{K_{AC}}(R_{ \lceil \frac{L}{2} \rceil}^{A'}) (E_{K_{BC}}(R_{1}^{B'}), E_{K_{BC}}(R_{2}^{B'}), \ldots, E_{K_{BC}}(R_{ \lceil \frac{L}{2} \rceil}^{B'}))\) and gets \(R_{1}^{A'}, R_{2}^{A'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{A'}(R_{1}^{B'}, R_{2}^{B'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{B'})\).

For \(j = 1, 2, \ldots, \lceil \frac{L}{2} \rceil\), Calvin uses Bell basis to measure two particles \(P_{C_{1}}^{j}P_{C_{2}}^{j}\) in \(S_{C_{1}}S_{C_{2}}\), We denote the collapsed Bell state of Calvin with \(M_{j}^{C}\). If \(M_{j}^{C} = \vert \varPhi^{ +} \rangle\), then \(R_{j}^{C}(r_{j}^{C1}r_{j}^{C2}) = 00; M_{j}^{C} = \vert \varPhi^{ -} \rangle\), then \(R_{j}^{C}(r_{j}^{C1}r_{j}^{C2}) = 01; M_{j}^{C} = \vert \varPsi^{ +} \rangle\), then \(R_{j}^{C}(r_{j}^{C1}r_{j}^{C2}) = 10; M_{j}^{C} = \vert \varPsi^{ -} \rangle\), then \(R_{j}^{C}(r_{j}^{C1}r_{j}^{C2}) = 11\); Calvin calculates \(R_{j}(r_{j}^{1}r_{j}^{2}) = R_{j}^{A'} \oplus R_{j}^{B'}\).

(8) Calvin calculates \(R = \sum_{j = 1}^{ \lceil \frac{L}{2} \rceil} ((r_{j}^{1} \oplus r_{j}^{C1}) + (r_{j}^{2} \oplus r_{j}^{C2}))\) and sends R to Alice and Bob. If R=0, Alice and Bob know X=Y; otherwise, Alice and Bob know XY.

3 Analysis

3.1 Correctness

In this section, we show that the output of our protocol is correct. Alice has a private information X, Bob has a private information Y. The binary representations of X and Y in \(F_{2^{L}}\) are (x 0,x 1,…,x L−1) and (y 0,y 1,…,y L−1), where x j ,y j ∈{0,1}, \(X = \sum_{j = 0}^{L - 1} x_{j}2^{j}\), \(Y = \sum_{j = 0}^{L - 1} y_{j}2^{j}\), j=0,…,L−1;2L−1≤max{x,y}≤2L. Alice and Bob divide their binary representations of X and Y into \(\lceil \frac{L}{2} \rceil\) groups, \(G_{A}^{1}, G_{A}^{2}, \ldots, G_{A}^{ \lceil \frac{L}{2} \rceil}\) and \(G_{B}^{1}, G_{B}^{2}, \ldots, G_{B}^{ \lceil \frac{L}{2} \rceil}\).

For \(j = 1, 2, \ldots, \lceil \frac{L}{2} \rceil\), Alice, Bob and Calvin use four-particle entangled W state \(\vert W \rangle_{1234} = \frac{1}{2} ( \vert 0001 \rangle + \vert 0010 \rangle + \vert 0100 \rangle + \vert 1000 \rangle )\) and Bell Entangled States \(\vert \varPhi^{ +} \rangle_{56} = \frac{1}{\sqrt{2}} ( \vert 00 \rangle + \vert 11 \rangle )\) to compare whether \(G_{j}^{A}\), \(G_{j}^{B}\) are equal or not. For simplicity, two cases of \(G_{j}^{A}\), \(G_{j}^{B}\)’s values are shown in Table 1 and other cases can use the same way to get. We denote Alice’s measurement outcome with \(M_{j}^{A}\), Bob’s measurement outcome with \(M_{j}^{B}\) and Calvin’s measurement outcome with \(M_{j}^{C}\). The represents of \(M_{j}^{A},M_{j}^{B},M_{j}^{C}\) are denoted as \(R_{j}^{A},R_{j}^{B},R_{j}^{C}(r_{j}^{C1}r_{j}^{C2})\). Alice agrees that |Φ ±〉 represent information 10; |Ψ ±〉 represent information 00. Bob and Calvin agree that |Φ +〉 represent information 00; |Φ 〉 represent information 01; |Ψ +〉 represent information 10; |Ψ 〉 represent information 11.

Table 1 Two cases of \(G_{j}^{A},G_{j}^{B}\)’s values

The result \(R_{j}^{A'} = R_{j}^{A} \oplus G_{j}^{A}\) and \(R_{j}^{B'} = R_{j}^{B} \oplus G_{j}^{B}\) are send to Calvin. After doing \(R_{j}(r_{j}^{1}r_{j}^{2}) = R_{j}^{A'} \oplus R_{j}^{B'}\) and \(R'_{j} = (r_{j}^{1} \oplus r_{j}^{C1}) + (r_{j}^{2} \oplus r_{j}^{C2})\), Calvin gets the result of the comparison between \(G_{j}^{A}\) and \(G_{j}^{B}\). If \(R'_{j} = 0\), then \(G_{j}^{A}=G_{j}^{B}\); otherwise \(G_{j}^{A} \neq G_{j}^{B}\). After comparing every group of two binary bits \(G_{j}^{A}\), \(G_{j}^{B}\) \((j = 1, 2, \ldots, \lceil \frac{L}{2} \rceil)\) in X, Y, if \(R = \sum_{j = 1}^{ \lceil \frac{L}{2} \rceil} ((r_{j}^{1} \oplus r_{j}^{C1}) + (r_{j}^{2} \oplus r_{j}^{C2})) = 0\), Calvin knows X=Y; if \(R = \sum_{j = 1}^{ \lceil \frac{L}{2} \rceil} ((r_{j}^{1} \oplus r_{j}^{C1}) + (r_{j}^{2} \oplus r_{j}^{C2})) \ne 0\), Calvin knows XY.

3.2 Security

In this section, the security of the protocol is analyzed. Firstly, the outside attack is invalid to our protocol is presented. Any information about the private information and the comparison result of private inputs will not be leaked out. Secondly, we show that the Alice and Bob cannot get any information about the private information of each other and the semi-honest third party, Calvin, also cannot get any information about the private information of Alice and Bob.

3.2.1 Outside Attack

We analyze the possibility of the outside eavesdropper to gain information about X and Y in every step of protocol.

In steps 1, 2, 5, 7, 8, there is not any information to transmit. In step 3, the outside eavesdropper can attack the quantum channel when Alice (Bob) sent \(S_{B_{1}^{*}}\), \(S_{C_{1}^{*}} (S_{C_{2}^{*}})\) to Bob and Calvin (Calvin). In step 4, we executed eavesdropper checking process and several kinds of outside attacks, such as the intercept-resend attack, the measure-resend attack, were detected with nonzero probability. In step 6, Alice and Bob used the quantum-one-time pad and sent \(R_{1}^{A'}, R_{2}^{A'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{A'} (R_{1}^{B'}, R_{2}^{B'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{B'})\) to Calvin. The outside eavesdroppers also cannot get \(R_{1}^{A'}, R_{2}^{A'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{A'}\) and \(R_{1}^{B'}, R_{2}^{B'}, \ldots, R_{ \lceil \frac{L}{2} \rceil}^{B'}\) in this step.

So in every step of our protocol, the outside eavesdropper cannot eavesdrop any information about X and Y.

3.2.2 Participant Attack

The term “participant attack”, which emphasizes that the attacks from dishonest users are generally more powerful and should be paid more attention to, is first proposed by Gao et al. in Ref. [46] and has attracted much attention in the cryptanalysis of quantum cryptography [4754]. In this section, we analyze the possibility of the three parties to get information about X and Y.

Case 1: Alice attempts to obtain Bob’s private information Y.

In our protocol, Alice gets nothing from Bob. So she cannot infer any information about Bob’s private information Y.

Case 2: Bob attempts to obtain Alice’s private information X.

In our protocol, Bob only get \(S_{B_{1}^{*}}\) from Alice. \(S_{B_{1}^{*}}\) isn’t relevant to Alice’s private information, so he cannot deduce any information about Alice’s private information X.

Case 3: Calvin attempts to obtain the private information X, Y.

Calvin can only infer private information X, Y from \(R_{j}(r_{j}^{1}r_{j}^{2}) = R_{j}^{A'} \oplus R_{j}^{B'} = (R_{j}^{A} \oplus G_{j}^{A}) \oplus (R_{j}^{B} \oplus G_{j}^{B})\) and the measurement result \(M_{j}^{C}\) of (\(P_{C_{1}}^{j}P_{C_{2}}^{j}\)). Because these measurement results have the same probability which is shown in Table 1, Calvin cannot deduce \(G_{j}^{A}\), \(G_{j}^{B}\) from R j .

In our protocol, Calvin knows the comparing results of each group. But, only with these results, he also cannot deduce the value of every group. So Calvin cannot learn the private information X, Y.

4 Discussion and Conclusions

In summary, we proposed a new QPC protocol based on four-particle entangled W state and Bell Entangled States swapping. Two parties can know whether their private information X and Y are equal or not through the help of a semi-honest Calvin. And they cannot learn private information owned by each other. Calvin also cannot learn any information about the private information X and Y except the comparing results. Comparing to others protocols, we can not only withstand outside attacks and protect the privacy of X and Y, but also not use the Pauli local unitary operation.