1 Introduction

The security problem of information transmission has resulted in wide attention. However, to guarantee the security of information transmission, quantum cryptography, not underlying the computational hardness problems, has been conceived by Wiesner [1]. In 1984, Bennett et al. invented the first quantum key distribution (QKD) protocol, which can achieve theoretically unconditional security [2]. Except QKD protocols [2,3,4], many quantum cryptography protocols have been invented to solve various security communication issues, such as quantum secure direct communication (QSDC) [5, 6], quantum secret sharing (QSS) [7,8,9], quantum key agreement (QKA) [10, 11].

In 1982, Andrew Yao introduced the concept of the millionaire problem [12], addressing whether two or more participants have the same secret information as each other without leaking their own secret information. After performing related research on the classical communication problems, multiparty secure computation, as a branch of cryptography, was born. Quantum private comparison (QPC) protocols were an important family member of multiparty secure computation. In 2009, Yang et al. designed the first QPC protocol based on Bell states, allowing two participants to compare the equality of their secrets with the assistance of a semi-honest third party (TP) and decoy photons [13]. Chen et al. invented an efficient QPC protocol with the triplet GHZ states by carrying out the simpler single-particle measurement [14]. Subsequently, different QPC protocols were designed based on different quantum entangled states, such as EPR pair [15], W state and Bell state [16], Bell state and five-qubit genuinely entangled state [17], cluster state and extended Bell state [18], GHZ state [19]. A two-party QPC protocol was put forward with the four-particle GHZ states, and greatly compared the equality of three information bits in each round of comparison to ensure relatively high efficiency [20]. Huang et al. utilized the entanglement swapping and GHZ-basis measurement to compare two parties’ secrets practically [21]. A new QPC protocol was raised with the hyperentangled GHZ state to compare secret inputs securely and efficiently [22]. Huang et al. constructed a QPC protocol with arbitrary single-qubit states, which is easy to implement [23]. In addition, Xiao et al. designed a fault-tolerant QPC protocol to fulfill higher encoding efficiency by applying the classical linear block code [24].

These above-mentioned two-party QPC protocols were based on the low-dimensional single-particle states or low-dimensional entanglement states. Each particle can encode only one bit, thereby restricting the transmission efficiency of secret information. With the constantly increase of the number of dimensions, high-dimensional single-particle states or high-dimensional entangled states enables to encode much more information. From then on, many scholars started paying more attention on how to employ high-dimensional entanglement states to solve the two-party QPC protocols’ problems. In 2011, Jia et al. first introduced the \(d\)-level GHZ states to compare two participants’ privacies, which was able to solve the millionaire problem [25]. To improve the security of the protocol, the secret information can be coded into the phases of the \(d\)-level GHZ states by local operations and retrieved by the collective measurements of TP. In 2013, Yu et al. came up with a QPC protocol based on the \(d\)-level single-particle states and unitary operation, which can compare the size relationship of two parties’ secrets [26]. Guo et al. proposed a QPC protocol with \(d\)-dimensional Bell states and bit-shifting operation, which is efficient and economic due to the property of entanglement swapping [27]. Subsequently, Li et al. applied the quantum Fourier transform and CNOT operation to provide higher communication efficiency by fulfilling the secret-by-secret comparison [28]. In 2021, Wu et al. designed a QPC protocol based on the \(d\)-level Bell states with a semi-honest TP, which can determine the size relation of two participants’ private data [29]. Wang et al. designed a multi-party QPC protocol to compare the size relation of secret information with the \(d\)-dimensional Bell states without involving the unitary operation [30]. To reduce the consumption of quantum devices, various semi-quantum private comparison (SQPC) protocols have been extensively studied recently. Zhou et al. designed a novel SQPC protocol with employing the entanglement correlation of the \(d\)-dimensional Bell states [31]. Wang et al. put forward a SQPC protocol with the \(d\)-dimensional GHZ states to compare the size of two clients’ privacies [32]. In 2022, Luo et al. came up with a mediated semi-quantum QPC protocol based on the high-dimensional Bell states to solve the millionaires’ problem [33]. Ye et al. designed a multi-party SQPC protocol based on the \(d\)-dimensional single-particle states, which can compare the size of multiple clients’ secret inputs [34].

However, these above-mentioned high-dimensional entanglement states were conflicted to implement in physical experiments. In 2016, the first multi-photon \(\left( {3, \, 3, \, 2} \right)\) entangled state with particle numbers and dimensions greater than two was generated experimentally [35]. Xiang et al. put forward a QSS protocol with the 4D GHZ-like state, where each party needs to perform single-particle measurement [7]. In 2018, Erhard et al. created a three-particle GHZ state entangled in three levels for every particle to carry more information [36]. In 2020, Hu et al. applied the path mode of photons to prepare a real multi-particle \(\left( {4, \, 4, \, 2} \right)\) entangled state experimentally, which can construct more complicated high-dimensional quantum networks [37]. The tripartite layered quantum key distribution protocol with the \(\left( {4, \, 4, \, 4} \right)\) entangled state was presented to effectively ensure the fairness among the communication parties [38].

Enlightened by the work in [7], we come up with a new two-party QPC protocol based on the 4D GHZ-like entangled states, which can compare one classical bit in each comparison. Furthermore, with the help of decoy photons and QKD protocol, it can better check whether there exists the eavesdropper Eve.

The remaining parts of this paper are organized as follows. In Sect. 2, the quantum circuit and the measurement results are presented. In Sect. 3, the protocol is described in detail. In Sect. 4, the security and the correctness of our proposed protocol are analyzed. In Sect. 5, the proposed protocol is compared with the existing protocols, and a brief conclusion is given in Sect. 6.

2 Preliminaries

A four-dimensional three-particle entangled state, 4D GHZ-like state, is expressed as

$$ \left| \zeta \right\rangle_{TAB} = \, \frac{1}{2}\left( {\left| {000} \right\rangle + \left| {111} \right\rangle + \left| {222} \right\rangle + \left| {333} \right\rangle } \right)_{TAB} . $$
(1)

To show online preparation and verification of 4D GHZ-like state better by applying the IBM Quantum Experimental platform [39], high-dimensional quantum entangled state is transformed into the two-dimensional quantum entangled state,

$$ \left| 0 \right\rangle \to \left| {00} \right\rangle {, }\left| 1 \right\rangle \to \left| {01} \right\rangle {, }\left| 2 \right\rangle \to \left| {10} \right\rangle {, }\left| 3 \right\rangle \to \left| {11} \right\rangle . $$
(2)

The six-qubit entangled state is written as

$$ \left| \zeta \right\rangle_{TAB}^{^{\prime}} = \, \frac{1}{2}\left( {\left| {000000} \right\rangle + \left| {010101} \right\rangle + \left| {101010} \right\rangle + \left| {111111} \right\rangle } \right)_{TAB}^{^{\prime}} . $$
(3)

It is clearly seen that the measurement results of the odd particles and the even particles are equal. Taking advantage of this property, the gate operations for preparing a six-qubit entangled state are shown in Fig. 1a, which consists of Hadamard operations and CNOT gate operations. To make the experiment more realistic, the simulation of the six-qubit state is performed by 5000 counts. The measurement results are described in Fig. 1b. In summary, it is verified that the scheme of preparing the six-qubit state is correct and feasible.

Fig. 1
figure 1

Quantum circuit a and statistical diagram of measurement results b with the protocol

In the suggested protocol, two sets of orthogonal bases are Z-basis and X-basis, respectively. \(\left\{ {\left| 0 \right\rangle , \, \left| 1 \right\rangle , \, \left| 2 \right\rangle , \, \left| 3 \right\rangle } \right\}\) belongs to Z-basis. \(\left\{ {\left| e \right\rangle {, }\left| f \right\rangle {, }\left| g \right\rangle {, }\left| h \right\rangle } \right\}\) is described as

$$ \left| e \right\rangle { = }\frac{1}{2}\left( {\left| 0 \right\rangle + \left| 1 \right\rangle + \left| 2 \right\rangle + \left| 3 \right\rangle } \right), $$
(4)
$$ \left| f \right\rangle { = }\frac{1}{2}\left( {\left| 0 \right\rangle - {\text{i}}\left| 1 \right\rangle - \left| 2 \right\rangle + {\text{i}}\left| 3 \right\rangle } \right), $$
(5)
$$ \left| g \right\rangle { = }\frac{1}{2}\left( {\left| 0 \right\rangle - \left| 1 \right\rangle + \left| 2 \right\rangle - \left| 3 \right\rangle } \right), $$
(6)
$$ \left| h \right\rangle { = }\frac{1}{2}\left( {\left| 0 \right\rangle + {\text{i}}\left| 1 \right\rangle - \left| 2 \right\rangle - {\text{i}}\left| 3 \right\rangle } \right). $$
(7)

where \({\text{i}}\) is an imaginary number and \({\text{i}}^{2} { = } - 1\). If TP performs the single-qubit measurement on particle T in the state \(\left| \zeta \right\rangle_{TAB}\) with X-basis, \(\left| \zeta \right\rangle_{TAB}\) on particles A and B will collapse into one of the following results,

$$ \left\langle {\left. e \right|\zeta } \right\rangle_{TAB} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right|{ + }\left\langle {1} \right|{ + }\left\langle {2} \right|{ + }\left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{000}} \right\rangle { + }\left| {{111}} \right\rangle { + }\left| {{222}} \right\rangle { + }\left| {{333}} \right\rangle } \right)_{TAB} = \frac{1}{2}\left| \zeta \right\rangle_{AB}^{00} , $$
(8)
$$ \left\langle {\left. f \right|\zeta } \right\rangle_{TAB} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| - {\text{i}}\left\langle {1} \right| - \left\langle {2} \right|{\text{ + i}}\left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{000}} \right\rangle { + }\left| {{111}} \right\rangle { + }\left| {{222}} \right\rangle { + }\left| {{333}} \right\rangle } \right)_{TAB} = \frac{1}{2}\left| \zeta \right\rangle_{AB}^{01} , $$
(9)
$$ \left\langle {\left. g \right|\zeta } \right\rangle_{TAB} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| - \left\langle {1} \right|{ + }\left\langle {2} \right| - \left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{000}} \right\rangle { + }\left| {{111}} \right\rangle { + }\left| {{222}} \right\rangle { + }\left| {{333}} \right\rangle } \right)_{TAB} = \frac{1}{2}\left| \zeta \right\rangle_{AB}^{10} , $$
(10)
$$ \left\langle {\left. h \right|\zeta } \right\rangle_{TAB} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| + {\text{i}}\left\langle {1} \right| - \left\langle {2} \right| - {\text{i}}\left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{000}} \right\rangle { + }\left| {{111}} \right\rangle { + }\left| {{222}} \right\rangle { + }\left| {{333}} \right\rangle } \right)_{TAB} = \frac{1}{2}\left| \zeta \right\rangle_{AB}^{11} . $$
(11)

Therefore, the quantum state \(\left| \zeta \right\rangle_{TAB}\) is written as

$$ \left| \zeta \right\rangle_{TAB} = \frac{1}{2}\left( {\left| e \right\rangle_{T} \left| \zeta \right\rangle_{AB}^{{{00}}} + \left| f \right\rangle_{T} \left| \zeta \right\rangle_{AB}^{{{01}}} + \left| g \right\rangle_{T} \left| \zeta \right\rangle_{AB}^{10} + \left| h \right\rangle_{T} \left| \zeta \right\rangle_{AB}^{11} } \right). $$
(12)

If TP performs the single-qubit measurement on particle A in the state \(\left| \zeta \right\rangle_{AB}^{00}\) with X-basis, the quantum state \(\left| \zeta \right\rangle_{AB}^{00}\) on particles B will collapse into one of the following four results:

$$ \left\langle {\left. e \right|\zeta } \right\rangle_{{_{AB} }}^{00} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right|{ + }\left\langle {1} \right|{ + }\left\langle {2} \right|{ + }\left\langle {3} \right|} \right) \times \frac{1}{2}\left( {\left| {{00}} \right\rangle { + }\left| {{11}} \right\rangle { + }\left| {{22}} \right\rangle { + }\left| {{33}} \right\rangle } \right)_{AB} = \frac{{1}}{{2}}\left| e \right\rangle_{B} , $$
(13)
$$ \left\langle {\left. f \right|\zeta } \right\rangle_{{_{AB} }}^{00} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| - {\text{i}}\left\langle {1} \right| - \left\langle {2} \right|{\text{ + i}}\left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{00}} \right\rangle { + }\left| {{11}} \right\rangle { + }\left| {{22}} \right\rangle { + }\left| {{33}} \right\rangle } \right)_{AB} = \frac{{1}}{{2}}\left| h \right\rangle_{B} , $$
(14)
$$ \left\langle {\left. g \right|\zeta } \right\rangle_{{_{AB} }}^{00} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| - \left\langle {1} \right|{ + }\left\langle {2} \right| - \left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{00}} \right\rangle { + }\left| {{11}} \right\rangle { + }\left| {{22}} \right\rangle { + }\left| {{33}} \right\rangle } \right)_{AB} = \frac{{1}}{{2}}\left| g \right\rangle_{B} , $$
(15)
$$ \left\langle {\left. h \right|\zeta } \right\rangle_{{_{AB} }}^{00} { = }\frac{{1}}{{2}}\left( {\left\langle {0} \right| + {\text{i}}\left\langle {1} \right| - \left\langle {2} \right| - {\text{i}}\left\langle {3} \right|} \right) \times \frac{{1}}{{2}}\left( {\left| {{00}} \right\rangle { + }\left| {{11}} \right\rangle { + }\left| {{22}} \right\rangle { + }\left| {{33}} \right\rangle } \right)_{AB} = \frac{{1}}{{2}}\left| f \right\rangle_{B} . $$
(16)

Therefore, \(\left| \zeta \right\rangle_{AB}^{00}\) is transformed as

$$ \left| \zeta \right\rangle_{AB}^{00} { = }\frac{{1}}{{2}}\left( {\left| e \right\rangle \left| e \right\rangle + \left| f \right\rangle \left| h \right\rangle + \left| g \right\rangle \left| g \right\rangle { + }\left| h \right\rangle \left| f \right\rangle } \right)_{AB} . $$
(17)

According to Eqs. (8)–(11), the other states are denoted as

$$ \left| \zeta \right\rangle_{AB}^{01} { = }\frac{{1}}{{2}}\left( {\left| e \right\rangle \left| h \right\rangle + \left| f \right\rangle \left| g \right\rangle + \left| g \right\rangle \left| f \right\rangle { + }\left| h \right\rangle \left| e \right\rangle } \right)_{AB} , $$
(18)
$$ \left| \zeta \right\rangle_{AB}^{10} { = }\frac{{1}}{{2}}\left( {\left| e \right\rangle \left| g \right\rangle + \left| f \right\rangle \left| f \right\rangle + \left| g \right\rangle \left| e \right\rangle { + }\left| h \right\rangle \left| h \right\rangle } \right)_{AB} , $$
(19)
$$ \left| \zeta \right\rangle_{AB}^{11} { = }\frac{{1}}{{2}}\left( {\left| e \right\rangle \left| f \right\rangle + \left| f \right\rangle \left| e \right\rangle + \left| g \right\rangle \left| h \right\rangle { + }\left| h \right\rangle \left| g \right\rangle } \right)_{AB} . $$
(20)

According to Eqs. (12), (17)–(20), \(\left| \zeta \right\rangle_{TAB}\) is rewritten as

$$ \begin{aligned} \left| \zeta \right\rangle_{TAB} & = \, \frac{{1}}{{4}}\left( {\left| {eee} \right\rangle + \left| {efh} \right\rangle + \left| {egg} \right\rangle + \left| {ehf} \right\rangle } \right)_{TAB} { + }\frac{{1}}{{4}}\left( {\left| {feh} \right\rangle + \left| {ffg} \right\rangle + \left| {fgf} \right\rangle + \left| {fhe} \right\rangle } \right)_{TAB} \\ \, & \;\;\;\;{ + }\frac{{1}}{{4}}\left( {\left| {geg} \right\rangle + \left| {gff} \right\rangle + \left| {gge} \right\rangle + \left| {ghh} \right\rangle } \right)_{TAB} { + }\frac{{1}}{{4}}\left( {\left| {hef} \right\rangle + \left| {hfe} \right\rangle + \left| {hgh} \right\rangle + \left| {hhg} \right\rangle } \right)_{TAB} . \\ \end{aligned} $$
(21)

Consequently, TP, Alice and Bob perform the single-qubit measurement in the quantum state \(\left| \zeta \right\rangle_{TAB}\) with X basis. In every measurement outcomes, the value of TP, Alice and Bob denote \(M_{T}^{i}\), \(M_{A}^{i}\) and \(M_{B}^{i}\), respectively, where \(i = 0, \, 1, \ldots ,L - 1\). For TP, Alice and Bob, \(\left| e \right\rangle\), \(\left| f \right\rangle\), \(\left| g \right\rangle\), \(\left| h \right\rangle\) represent 0, 1, 0, 1, respectively. Apparently, in the measurement outcomes, the value of TP, Alice and Bob satisfy

$$ M_{T}^{i} \oplus M_{A}^{i} \oplus M_{B}^{i} { = }0. $$
(22)

3 Two-party QPC protocol based on the 4D GHZ-like states

Suppose there are two participants Alice and Bob, Alice has the secret information \(H\), while Bob has the secret information \(J\), where the binary representations of \(H\) and \(J\) in \(F_{{2^{L} }}\) are \(\left( {x_{0} , \, x_{1} , \ldots ,x_{L - 1} } \right)\) and \(\left( {y_{0} , \, y_{1} , \ldots ,y_{L - 1} } \right)\), respectively, where \(x_{i} , \, y_{i} \in \left\{ {0, 1} \right\}\), \(H = \sum_{i = 0}^{L - 1} x_{i} 2^{i}\) and \(J = \sum_{i = 0}^{L - 1} x_{i} 2^{i}\).

In the meantime, Alice and TP, Bob and TP, Alice and Bob share a common key sequence \(K_{AT}\), \(K_{BT}\) and \(K_{AB}\) by a secure QKD protocol as

$$ K_{AT} = K_{AT}^{0} K_{AT}^{1} K_{AT}^{2} \ldots K_{AT}^{L - 1} $$
(23)
$$ K_{BT} = K_{BT}^{0} K_{BT}^{1} K_{BT}^{2} \ldots K_{BT}^{L - 1} $$
(24)
$$ K_{AB} = K_{AB}^{0} K_{AB}^{1} K_{AB}^{2} \ldots K_{AB}^{L - 1} $$
(25)

where \(K_{AT}^{i} , \, K_{BT}^{i} , \, K_{AB}^{i} \in \left\{ {0, \, 1} \right\}\). The process of the protocol is clearly depicted in Fig. 2.

Fig. 2
figure 2

The proposed QPC protocol based on the 4D GHZ-like states

Step 1 Alice (Bob) divides her (his) binary representation \(H \, \left( J \right)\) into \(L\) groups \(D_{A}^{0} , \, D_{A}^{1} , \ldots , \, D_{A}^{L - 1} \, \left( {D_{B}^{0} , \, D_{B}^{1} , \ldots , \, D_{B}^{L - 1} } \right)\), where each group contains one binary bit.

Step 2 According to Eq. (1), TP generates \(L\) 4D three-particle quantum entanglement states to construct a quantum state sequence \({\text{P}}_{{\text{T}}}^{0} {\text{P}}_{{\text{A}}}^{0} {\text{P}}_{{\text{B}}}^{0} {\text{P}}_{{\text{T}}}^{1} {\text{P}}_{{\text{A}}}^{1} {\text{P}}_{{\text{B}}}^{1} \ldots {\text{P}}_{{\text{T}}}^{L - 1} {\text{P}}_{{\text{A}}}^{L - 1} {\text{P}}_{{\text{B}}}^{L - 1}\), where \(T,{\text{ A}},{\text{ B}}\) denote three particles in one three-particle entanglement state and the superscripts denote the orders of three-particle entanglement state in this quantum state sequence. TP divides these three-particle quantum states to form three ordered Sequences \(S_{T}\), \(S_{A}\) and \(S_{B}\),

$$ S_{A} { = }P_{A}^{0} P_{A}^{1} \ldots P_{A}^{L - 1} , $$
(26)
$$ S_{B} { = }P_{B}^{0} P_{B}^{1} \ldots P_{B}^{L - 1} , $$
(27)
$$ S_{T} { = }P_{T}^{0} P_{T}^{1} \ldots P_{T}^{L - 1} . $$
(28)

Step 3 TP prepares two sets of decoy photons \(C_{1}\) and \(C_{2}\). Each decoy photon is randomly selected from the state set \(\left\{ {\left| {0} \right\rangle {, }\left| {1} \right\rangle {, }\left| {2} \right\rangle {, }\left| {3} \right\rangle {, }\left| e \right\rangle {, }\left| f \right\rangle {, }\left| g \right\rangle {, }\left| h \right\rangle } \right\}\). Then, TP randomly inserts \(C_{1} \, \left( {C_{2} } \right)\) into Sequence \(S_{A} \, \left( {S_{B} } \right)\) to construct a new Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\). Finally, TP sends Sequences \(S_{A}^{^{\prime}}\) and \(S_{B}^{^{\prime}}\) to Alice and Bob, respectively, and retains Sequence \(S_{T}\) in his own hand.

Step 4 After confirming Alice (Bob) has received Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\), TP informs Alice (Bob) of the positions and the bases of every decoy photon in \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\). Then, Alice (Bob) performs the corresponding measurement on all decoy photons and notifies TP of the measurement results. TP judges whether there exists an eavesdropper. If the error rate is higher than expected, Alice (Bob) will abort the protocol and restart from Step 1; Otherwise, Alice (Bob) will discard all decoy photons in \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\) to restore original Sequence \(S_{A} \, \left( {S_{B} } \right)\) and continue the next step.

Step 5 Alice (Bob) measures the particle \(P_{A}^{i} \, \left( {P_{B}^{i} } \right)\) in X basis and obtains \(M_{A}^{i} \, \left( {M_{B}^{i} } \right)\). If the particle \(P_{A}^{i} \, (P_{B}^{i} )\) is \(\left| e \right\rangle \, \left( {\left| f \right\rangle } \right)\), the value of \(M_{A}^{i} \, \left( {M_{B}^{i} } \right)\) will be replaced by 0 (1). If the particle \(P_{A}^{i} (P_{B}^{i} )\) is \(\left| g \right\rangle \, \left( {\left| h \right\rangle } \right)\), the value of \(M_{A}^{i} \, \left( {M_{B}^{i} } \right)\) will be replaced by 0 (1). Subsequently, Alice (Bob) encrypts the private information such that \(R_{A}^{i} = D_{A}^{i} \oplus M_{A}^{i} \oplus K_{AT}^{i} \oplus K_{AB}^{i} \, \left( {R_{B}^{i} = D_{B}^{i} \oplus M_{B}^{i} \oplus K_{BT}^{i} \oplus K_{AB}^{i} } \right)\). In the end, Alice (Bob) delivers \(R_{A} \, \left( {R_{B} } \right)\) to TP via the classical channel, where \(R_{A} { = }\left[ {R_{A}^{0} , \, R_{A}^{1} , \ldots , \, R_{A}^{L - 1} } \right]\) \(\left( {R_{B} { = }\left[ {R_{B}^{0} , \, R_{B}^{1} , \ldots , \, R_{B}^{L - 1} } \right]} \right)\).

Step 6 TP measures the particle \(P_{T}^{i}\) in X basis and obtains \(M_{T}^{i}\) according to the measurement outcomes, where the measurement outcomes of \(P_{T}^{i}\) are shown in Table 1. Afterwards, TP calculates \(R^{i}\), where \(R^{i} \in \left\{ {0, \, 1} \right\}\). If \(R^{i}\) is 0, TP will conclude that their privacies are equal; Otherwise, TP will consider that their privacies are different. Eventually, TP announces the comparison results to Alice (Bob) via a classical channel.

Table 1 The measurement outcomes of TP, Alice and Bob

4 Correctness and security

4.1 Correctness

According to Eq. (22), one can obtain

$$ \begin{aligned} R^{i} \, & { = }R_{A}^{i} \oplus R_{B}^{i} \oplus M_{T}^{i} \oplus K_{AT}^{i} \oplus K_{BT}^{i} \\ & { = }\left( {D_{A}^{i} \oplus M_{A}^{i} \oplus K_{AT}^{i} \oplus K_{AB}^{i} } \right) \\ & \;\;\;\; \oplus \left( {D_{B}^{i} \oplus M_{B}^{i} \oplus K_{BT}^{i} \oplus K_{AB}^{i} } \right) \oplus M_{T}^{i} \oplus K_{AT}^{i} \oplus K_{BT}^{i} \\ & { = }\left( {D_{A}^{i} \oplus D_{B}^{i} } \right) \oplus \left( {M_{A}^{i} \oplus M_{B}^{i} \oplus M_{T}^{i} } \right) \\ & { = }D_{A}^{i} \oplus D_{B}^{i} . \\ \end{aligned} $$
(29)

Therefore, the protocol is correct. If \(R^{i}\) is equal to 0, then \(D_{A}^{i}\) will be equal to \(D_{B}^{i}\); Otherwise, \(D_{A}^{i} \, \ne \, D_{B}^{i}\).

4.2 Security

Both participant attack and outside attack on the proposed protocol will be analyzed.

4.2.1 Participant attack

In the proposed protocol, we consider two cases of participant attacks. First of all, we analyze the security of the proposed protocol against the attacks of dishonest participants. Afterwards, the attack of semi-honest TP is also analyzed.

4.2.1.1 Case 1 Dishonest Alice (Bob) attempts to obtain Bob’s (Alice’s) privacies

As an internal attacker, Alice (Bob) attempts to obtain Bob (Alice)’s privacies. In the protocol, Alice (Bob) does not transmit any information to Bob (Alice) except the pre-shared key \(K_{AB}\). Alice (Bob) only knows \(D_{A}^{i} {, }K_{AT}^{i} {, }K_{AB}^{i} {, }M_{A}^{i} \, \left( {D_{B}^{i} {, }K_{BT}^{i} {, }K_{AB}^{i} {, }M_{B}^{i} } \right)\). If Alice (Bob) obtains \(P_{B}^{i} \, \left( {P_{A}^{i} } \right)\) and \(R_{B}^{i} \, \left( {R_{A}^{i} } \right)\), she (he) will be regarded as an outside attacker. Furthermore, Alice (Bob) cannot obtain \(K_{BT}^{i} \, \left( {K_{AT}^{i} } \right)\) and \(D_{B}^{i} \, \left( {D_{A}^{i} } \right)\). In addition, if Alice (Bob) achieves \(P_{B}^{i} \, \left( {P_{A}^{i} } \right)\) and \(R_{B}^{i} \, \left( {R_{A}^{i} } \right)\) without being discovered, Alice (Bob) will not access other participant’s private information, since Alice (Bob) cannot obtain \(K_{BT}^{i} \, \left( {K_{AT}^{i} } \right)\). Therefore, the privacies \(D_{A}^{i} \, \left( {D_{B}^{i} } \right)\) are not eavesdropped in theory.

4.2.1.2 Case 2 Semi-honest TP tries to obtain (Alice’s) Bob’s privacies

In the suggested protocol, TP obtains the shared secret keys \(K_{AT}^{i} {, }K_{BT}^{i}\) and knows \(R_{A}^{i} {, }R_{B}^{i}\) in Step 5. As a semi-honest third party, TP may acquire the secret information of Alice (Bob) through a quantum channel in Step 4. In a word, if TP attacks the transmitted information between TP and participants with evading detection, it will be also secure even with the assistance of these information \(K_{AT}^{i} {, }K_{BT}^{i} {, }R_{A}^{i} {, }R_{B}^{i}\) in Case 2, since TP does not know the pre-shared sequence \(K_{AB}\). Therefore, TP cannot obtain any private information of participants. The protocol is secure against participant attacks.

4.2.2 Outsider attack

Suppose Eve is a malicious attacker, she attempts to steal the private information of participants. For this situation, we consider four cases of outside attacks.

4.2.2.1 Intercept-resend attack

Eve intercepts Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\) in Step 3 and then replaces Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\) with a fake sequence. Afterwards, she sends the fake sequence to Alice (Bob). Unfortunately, Eve does not know the position and the preparation basis of every decoy photon in Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\). Suppose Eve measures the decoy photon in Z-basis with Z-basis. It is known that she cannot be found in the eavesdropping detection. However, if she chooses X-basis to measure these decoy photons in Z-basis, there is a 25% probability for each photon to be eavesdropped. Therefore, based on the above two cases, the probability of avoiding Alice’s (Bob’s) detection is \(\frac{5}{8}\). If there are \(v\) decoy photons, the probability of being detected will be \(1 - \left( \frac{5}{8} \right)^{v}\). If \(v\) is big enough, the probability is going to be close to 1. Therefore, the intercept-resend attack in the QPC protocol does not work.

4.2.2.2 Measure-resend attack

The measure-resend attack is that the eavesdropper Eve intercepts the new Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\) transmitted from TP to participants and then directly measures the particle \(P_{A}^{i} \, \left( {P_{B}^{i} } \right)\). The new sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\) is randomly inserted with decoy particles. Subsequently, Eve still sends the measured sequence to participants. In this case, Eve is easily detected by the participants who perform the eavesdropping detection. Eve cannot distinguish the positions of decoy photons from Sequence \(S_{A}^{^{\prime}} \, \left( {S_{B}^{^{\prime}} } \right)\), so it cannot acquire any useful information.

4.2.2.3 Entangle-measure attack

Suppose Eve is a dishonest user. When the particle \(P_{A}^{i} \, \left( {P_{B}^{i} } \right)\) is transmitted between TP and participants one by one, Eve may intercept the particle \(P_{A}^{i} \, \left( {P_{B}^{i} } \right)\) in Step 3. Then, Eve prepares an auxiliary particle in \(\left| \zeta \right\rangle_{E}\) and entangles it with the particle \(P_{A}^{i} \, \left( {P_{B}^{i} } \right)\) sent between TP and participants via unitary operation \(U_{E}\). This attack can be denoted as

$$ U_{E} \left| l \right\rangle \left| \zeta \right\rangle_{E} = \sum\limits_{\mu = 0}^{3} {\lambda_{l\mu } } \left| \mu \right\rangle \left| {\eta_{l\mu } } \right\rangle_{E} . $$
(30)

According to Eq. (30), when \(l, \, \mu \in \{ 0, \, 1, \, 2, \, 3\}\), one can analyze the effect of Eve’s eavesdropping on the decoy photons \(\left\{ {\left| 0 \right\rangle , \, \left| 1 \right\rangle , \, \left| 2 \right\rangle , \, \left| 3 \right\rangle } \right\}\),

$$ U_{E} \left| 0 \right\rangle \left| \zeta \right\rangle_{{\text{E}}} = \lambda_{00} \left| 0 \right\rangle \left| {\eta_{00} } \right\rangle + \lambda_{01} \left| 1 \right\rangle \left| {\eta_{01} } \right\rangle + \lambda_{02} \left| 2 \right\rangle \left| {\eta_{02} } \right\rangle + \lambda_{03} \left| 3 \right\rangle \left| {\eta_{03} } \right\rangle , $$
(31)
$$ U_{E} \left| 1 \right\rangle \left| \zeta \right\rangle_{{\text{E}}} = \lambda_{10} \left| 0 \right\rangle \left| {\eta_{10} } \right\rangle + \lambda_{11} \left| 1 \right\rangle \left| {\eta_{11} } \right\rangle + \lambda_{12} \left| 2 \right\rangle \left| {\eta_{12} } \right\rangle + \lambda_{13} \left| 3 \right\rangle \left| {\eta_{13} } \right\rangle , $$
(32)
$$ U_{E} \left| 2 \right\rangle \left| \zeta \right\rangle_{{\text{E}}} = \lambda_{20} \left| 0 \right\rangle \left| {\eta_{20} } \right\rangle + \lambda_{21} \left| 1 \right\rangle \left| {\eta_{21} } \right\rangle + \lambda_{22} \left| 2 \right\rangle \left| {\eta_{22} } \right\rangle + \lambda_{23} \left| 3 \right\rangle \left| {\eta_{23} } \right\rangle , $$
(33)
$$ U_{E} \left| 3 \right\rangle \left| \zeta \right\rangle_{{\text{E}}} = \lambda_{30} \left| 0 \right\rangle \left| {\eta_{30} } \right\rangle + \lambda_{31} \left| 1 \right\rangle \left| {\eta_{31} } \right\rangle + \lambda_{32} \left| 2 \right\rangle \left| {\eta_{32} } \right\rangle + \lambda_{33} \left| 3 \right\rangle \left| {\eta_{33} } \right\rangle , $$
(34)

where \(\left| \zeta \right\rangle_{E}\) is the initial state of ancillary particles. \(\left| {\eta_{l\mu } } \right\rangle\) is a pure state uniquely determined by unitary operation. In addition, \(\sum\nolimits_{\mu = 0}^{3} {\left| {\lambda_{l\mu } } \right|^{2} } = 1\).

If Eve attempts to eavesdrop without being detected, \(\lambda_{l\mu }\) must be 0 for the case that \(l \ne \mu\). The decoy photons are in one of the eight states \(\left\{ {\left| 0 \right\rangle , \, \left| 1 \right\rangle , \, \left| 2 \right\rangle , \, \left| 3 \right\rangle , \, \left| e \right\rangle , \, \left| f \right\rangle , \, \left| g \right\rangle , \, \left| h \right\rangle } \right\}\). Hence, if \(U_{E}\) acts on the decoy photons \(\left| e \right\rangle\), \(\left| f \right\rangle\), \(\left| g \right\rangle\) and \(\left| h \right\rangle\), one will obtain

$$ \begin{aligned} U_{E} \left| e \right\rangle \left| \zeta \right\rangle & = \frac{1}{2}\left( {\lambda_{00} \left| 0 \right\rangle \left| {\eta_{00} } \right\rangle + \lambda_{11} \left| 1 \right\rangle \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| 2 \right\rangle \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| 3 \right\rangle \left| {\eta_{33} } \right\rangle } \right) \\ & { = }\frac{1}{4}\left| e \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| f \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle + {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| g \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| h \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right), \\ \end{aligned} $$
(35)
$$ \begin{aligned} U_{E} \left| f \right\rangle \left| \zeta \right\rangle & = \frac{1}{2}\left( {\lambda_{00} \left| 0 \right\rangle \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| 1 \right\rangle \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| 2 \right\rangle \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| 3 \right\rangle \left| {\eta_{33} } \right\rangle } \right) \\ & { = }\frac{1}{4}\left| e \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| f \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| g \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle + {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| h \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| {\eta_{33} } \right\rangle } \right), \\ \end{aligned} $$
(36)
$$ \begin{aligned} U_{E} \left| g \right\rangle \left| \zeta \right\rangle & = \frac{1}{2}\left( {\lambda_{00} \left| 0 \right\rangle \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| 1 \right\rangle \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| 2 \right\rangle \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| 3 \right\rangle \left| {\eta_{33} } \right\rangle } \right) \\ & { = }\frac{1}{4}\left| e \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| f \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| g \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| h \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle + {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right), \\ \end{aligned} $$
(37)
$$ \begin{aligned} U_{E} \left| h \right\rangle \left| \zeta \right\rangle & = \frac{1}{2}\left( {\lambda_{00} \left| 0 \right\rangle \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| 1 \right\rangle \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| 2 \right\rangle \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| 3 \right\rangle \left| {\eta_{33} } \right\rangle } \right) \\ & { = }\frac{1}{4}\left| e \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle + {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| f \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| g \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle } \right) \\ & \;\;\;\;{ + }\frac{1}{4}\left| h \right\rangle \left( {\lambda_{00} \left| {\eta_{00} } \right\rangle + \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle + \lambda_{33} \left| {\eta_{33} } \right\rangle } \right). \\ \end{aligned} $$
(38)

If Eve is not being detected, the following equations will hold

$$ \left\{ \begin{gathered} \lambda_{00} \left| {\eta_{00} } \right\rangle - {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle + {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle = 0 \hfill \\ \lambda_{00} \left| {\eta_{00} } \right\rangle - \lambda_{11} \left| {\eta_{11} } \right\rangle + \lambda_{22} \left| {\eta_{22} } \right\rangle - \lambda_{33} \left| {\eta_{33} } \right\rangle = 0 \hfill \\ \lambda_{00} \left| {\eta_{00} } \right\rangle + {\text{i}}\lambda_{11} \left| {\eta_{11} } \right\rangle - \lambda_{22} \left| {\eta_{22} } \right\rangle - {\text{i}}\lambda_{33} \left| {\eta_{33} } \right\rangle = 0 \hfill \\ \end{gathered} \right.. $$
(39)

According to Eq. (39), one can conclude

$$ \lambda_{00} \left| {\eta_{00} } \right\rangle = \lambda_{11} \left| {\eta_{11} } \right\rangle = \lambda_{22} \left| {\eta_{22} } \right\rangle = \lambda_{33} \left| {\eta_{33} } \right\rangle . $$
(40)

It can be seen that Eve cannot distinguish \(\lambda_{00} \left| {\eta_{00} } \right\rangle , \, \lambda_{11} \left| {\eta_{11} } \right\rangle , \, \lambda_{22} \left| {\eta_{22} } \right\rangle\) and \( \, \lambda_{33} \left| {\eta_{33} } \right\rangle\) by only measuring her ancillary particles. In a word, if Eve attempts to obtain any private information, it is apparent that she will inevitably introduce errors and her entangle-measure attack will also easily be found during the eavesdropping detection. Therefore, the protocol can resist the entangle-measure attack.

4.2.2.4 Trojan horse attack

In this proposed one-way communication protocol, qubits are only transmitted from TP to participants. Therefore, it is immune to Trojan horse attacks. Although the attacker can inject some spy photons into the original qubits, they have no opportunity to extract Sequence \(S_{A} \, \left( {S_{B} } \right)\), since the spy photons cannot be retrieved. Thus, this protocol naturally avoids the Trojan horse attack. Therefore, Alice (Bob) does not require to install expensive devices (such as filter and photon number splitters) in the front of its quantum signal receiver. To sum up, Eve cannot obtain (Alice’s) Bob’s private information from the Trojan horse attack.

5 Comparison

The qubit efficiency is defined as \(\uptheta = \, \tau_{u} /\tau_{a}\), where \(\tau_{u}\) is the number of compared bits in each round of comparison while \(\tau_{a}\) is the total number of prepared particles and consumed decoy photons in each round of comparison. As shown in Table 2, the number of prepared particles is same as that the number of the consumed decoy photons in each comparison time. The suggested protocol fulfills the comparison of two parties’ secret information via the QKD protocol. Though QKD protocol consumes some resources, our protocol is more secure than those in [15, 16]. Unlike [21, 32,33,34], in our protocol, the existence of eavesdropping is checked with decoy photons. In addition, the proposed protocol is easier to realize than those protocols based on high-dimensional quantum states in [26, 27, 32,33,34]. In summary, the presented QPC protocol could compare the equality of one bit in each round of comparison, reducing the number of comparison times significantly. Compared with [15, 19], the qubit efficiency up to 10% is the lowest in [16], since the protocol needs to prepare \(\nu\) W states, \(\nu\) Bell states and \(4\nu\) decoy photons. In [20, 21], these two protocols can compare the equality of three information bits. In [20], the protocol only prepares \(5\nu\) particles and \(5\nu\) decoy photons, and the qubit efficiency is the highest in [15, 16, 19, 21]. In [27], the number of \(d\)-level Bell states used is \(4\nu - 1\), where there is \(2\nu - 2\) \(d\)-level Bell states as the eavesdropped detection. In [32], TP needs to prepare \(4\nu\) \(d\)-dimensional GHZ states, and Alice (Bob) needs to prepare \(2\nu\) single particles in the measure mode. In [33], TP needs to prepare \(4\nu\) \(d\)-dimensional Bell states, and Alice (Bob) needs to prepare \(2\nu\) single particles in the detect and encode mode. Therefore, the number of the consumed qudits is \(12\nu\). In [34], the number of qudits used is \(32\nu N\), where there are \(16\nu N\) qudits used in the measure mode and \(N\) represents the number of participants. Therefore, the qubit efficiency is the lowest among the other ten protocols. However, in [26], the protocol only prepares \(\nu\) \(d\)-level single particles and \({2}\nu\) decoy photons, and the qubit efficiency is the highest among the other ten protocols. In our protocol, TP needs to prepare \(\nu\) 4D GHZ-like states and \(2\nu\) decoy photons. Therefore, the number of the consumed qubits is \(5\nu\) to compare \(\nu\) bits of classical information. As a result, the qubit efficiency of our protocol is only up to 20%, not the highest in these protocols, but it is not necessary for our protocol to involve unitary operation or entanglement swapping operation, which could save more resources than those protocols in [16, 21, 26, 27].

Table 2 Comparison among some typical QPC protocols

6 Conclusion

A two-party QPC protocol is proposed by considering the 4D GHZ-like states as quantum resources. The decoy photons can greatly enhance the security and reliability of the suggested protocol. Furthermore, in terms of quantum operations, it only involves not unitary operation but single particle measurement and decoy photons, which makes our protocol more secure. However, the presented protocol only can compare the privacies of equality, where the participants in the protocol can only determine whether their secret information is same or different. In the future, we will dedicate to studying a two-party QPC protocol of size relation.