1. Introduction
Recently, research on quantum computers has continuously made new progress worldwide. Many scientists, companies and research institutions are committed to utilizing various quantum systems to develop quantum computers. It is foreseen that the successful development of quantum computers will have a profound impact in many fields. Cryptography is one such field.
The two most promising physical implementation schemes for quantum computers are trapped-ion [
1] and superconducting circuit [
2]. Ion-trap quantum computers have the advantage of great qubit connectivity and small decoherence, while superconducting quantum computers have the advantage of high designability and scalability. In recent years, investigations on ion-trap quantum computers have made great progress [
3,
4], especially in the improvement of high-fidelity gate [
5]. The study of superconducting quantum computers has also made remarkable progress [
6,
7,
8]. Google’s Sycamore quantum computer and IBM’s Eagle quantum computer are both based on superconductivity [
9,
10]. The power of quantum computers in information processing stems from the novel properties of quantum information that differ from those of classical information. Quantum computers possess the natural feature of parallel computing. When an
n-qubit quantum computer processes data, operators actually operate on
data states simultaneously. This parallelism may make some problems uncomputable in electronic computers become computable in quantum computers, such as factoring large integers, which is a difficult problem that many public key algorithms are built upon, but may be solved on quantum computers by running Shor’s algorithm [
11].
The threats posed by quantum computing to symmetric algorithms have also received considerable attention. The most typical example is Grover’s algorithm [
12], which requires only
complexity to search an unordered database with
M elements, while
complexity is required in classical computing. Another important algorithm used to attack symmetric schemes is Simon’s algorithm [
13]. It was first used for attacking Feistel ciphers [
14,
15,
16] and EM schemes [
14,
16]. It was then combined with Grover’s algorithm for extracting the keys of ciphers with FX, Feistel and generalized Feistel structures [
17,
18,
19]. For SPN ciphers, Jaques et al. investigated cryptanalysis of the AES algorithm using Grover’s algorithm [
20]. Zhang utilized quantum algorithms to attack generalized Feistel ciphers [
21]. Xiang introduced a method for constructing periodic functions and used it to attack LBlock cipher [
22]. In addition to the aforementioned quantum algorithms, the Bernstein–Vazirani (BV) algorithm [
23] was recently utilized in cryptanalysis [
24,
25,
26,
27].
In addition to specific attack strategies, cryptanalytic tools are also crucial for evaluating the security of cryptosystems. In this field, quantum algorithms were first used for differential cryptanalysis [
25,
28,
29] and then for linear cryptanalysis [
26,
29,
30]. Subsequently, quantum collision attacks on hash functions were studied [
31,
32]. Denisenko analyzed the complexity of quantum differential attack based on the quantum search algorithm [
33]. Hosoyamada used quantum algorithms to speed-up classical multidimensional linear attack [
34]. Xu et el. applied quantum search algorithm to differential meet-in-the-middle attack [
35]. Quantum attacks under this model were also proposed [
36,
37,
38]. Zhang proposed a quantum attack under quantum-related key model against the Sum of Even–Mansour construction [
39]. Wu and Feng used BV algorithm to search for related-key differentials and recover key based on quantum counting algorithm [
40]. These attacks showcased the superiority of quantum cryptanalytic tools over traditional cryptanalytic tools.
Many quantum attacks on block ciphers are too large in scale to be implemented or even simulated. However, researchers may be able to simulate a small part of the whole quantum attacks. For example, Zhou et al. simulated the quantum circuit of S-boxes instead of the whole cipher when studying the quantum circuit of AES [
41]. Qiskit SDK is a powerful open-source tool for the simulations of quantum algorithms. Many small-scale quantum algorithms have been simulated using Qiskit [
42,
43,
44]. LIGHTER-R is another useful tool proposed by Dasu, which can be used to design quantum circuits of Boolean functions [
45].
Contributions. In this study, we explore the applications of the Bernstein–Vazirani algorithm to two variants of differential attacks: truncated differential and boomerang attacks. First, we design a quantum algorithm for searching truncated differentials that have a high probability for a large proportion of keys in the key space. Subsequently, based on this algorithm, we construct another quantum algorithm for searching for boomerang distinguishers. We demonstrate the correctness of both quantum algorithms using rigorous proofs. Both quantum algorithms request only polynomial quantum gates and qubits and have the following advantages:
Quantum adversaries are able to perform the proposed attacks in
model. Namely, there is no need for quantum queries. Compared to many proposed quantum attack algorithms [
14,
15,
16,
18,
19,
46] that require quantum queries, our algorithms are easier to implement.
Classical cryptanalytic tools for finding truncated differentials with high probability or boomerang distinguishers usually cannot concern all of the details of the involved S-boxes when they are not at a small-scale. The classical tools can only search for truncated differentials or boomerang distinguishers of extremely few rounds when the S-boxes have an 8-bit scale, which is very common in block ciphers. By comparison, our quantum algorithms fully utilize the superiority of quantum computing to improve this issue. They entirely characterized the S-boxes through the accurate implementation of the unitary operator of the block ciphers.
Classical truncated differential attacks do not involve the key scheduling under the single-key attack model, but our algorithms incorporate the key scheduling into the quantum circuits and thus fully reflect its impact to the differential propagation.
Related works. Paul et al. combined classical boomerang attack with Grover’s algorithm to quantize the traditional boomerang attack [
47]. Zhou et al. improved this quantum attack strategy by allowing the retrieval of subkeys from both sides of block ciphers [
48]. Boomerang attack includes two stages. The first stage is to find boomerang distinguishers and the second stage is to recover the key using the found distinguishers. The works in [
47,
48] only focused on the second stage. Both of them studied the use of quantum algorithms for accelerating the retrieval of key. Our work focuses on the first stage and studies the use of quantum algorithms for finding boomerang distinguishers.
3. Quantum Truncated Differential Attack
Knudsen introduced the truncated differential attack in 1994 [
51]. This cryptanalytic method has been widely applied to attack symmetric ciphers [
58,
59]. In the initial version of differential attacks, the adversaries utilize full differences of plaintexts and ciphertexts, whereas in truncated differential attacks the adversaries consider differences partially determined. The adversaries only predict some bits of the differentials rather than the entire differentials.
We still consider the block cipher with the key space . A truncated differential of is a pair of vectors such that , where ∗ denotes an undetermined bit. Let , , , . then . The bits of () that take the value of zero or one are defined as predicted bits, whereas those with a value of ∗ are defined as unpredicted bits.
A truncated difference is equivalent to a set of complete differences. Define
then truncated differences
and
are equivalent to
and
, respectively. If a complete input difference
is in
, that is,
for all
,
such that
, we say that
matches the truncated difference
, and this case is denoted as
∼
. Similarly,
∼
implies that
matches the truncated difference
.
Conditional probability
is defined as the probability of
. If
p is equal to the probability of
, we call
a
p-probability truncated differential of
.
Let () be a reduced cipher of . In a truncated differential attack, the adversaries first search for a truncated differential of that has a high probability and then use this truncated differential, denoted as , to recover the subkeys involved in the last rounds. In detail, the adversaries fix the plaintext difference and then use pairs of plaintexts, whose differences match , to make encryption queries and obtain pairs of corresponding ciphertexts. Subsequently, for each possible candidate subkey of the last rounds, the adversaries use it to decrypt rounds to obtain M output differences of , in the meantime calculate the amount of the differences that match . Finally, the right subkey is the subkey having the maximum count.
The amount of plaintext pairs required in such a counting scheme and the success probability of obtaining the right key are determined by the ratio of signal to noise [
49], and its definition is
where
L denotes the total amount of possible subkeys involved in the last
rounds,
p denotes the probability of
,
denotes the average count that every plaintext pair contributes and
denotes the proportion of pairs not discarded in the preprocessing procedure. We do not consider any pre-discarding processes, therefore we set
. A truncated differential attack succeeds only when
. Thus, the adversaries should use a truncated differential that makes the ratio of signal to noise greater than one. The greater
is, the easier it is to single out the right subkey.
In the following, we propose a quantum algorithm used for finding truncated differentials. In a classical truncated differential attack, because the adversaries do not know the value of k of the reduced cipher , they must find a truncated differential whose probability is high regardless of the value of the key k. Therefore, our quantum algorithm is designed to search for truncated differentials that have high probability for a large proportion of keys in . Specifically, by choosing a polynomial , the adversaries can force our quantum algorithm to output truncated differentials that have a high probability for more than proportion of keys in . We present the algorithm and analyze its effectiveness and complexity.
3.1. Finding Truncated Differentials via BV Algorithm
Given a reduced block cipher , let , . That is, denotes the j-th component function of . An intuitive method for finding high-probability truncated differentials is to implement Algorithm 1 on every . If Algorithm 1 finds differentials of several component functions that all have high probability and have a common input difference, then we can derive a truncated differential of that has high probability. However, running Algorithm 1 on requires quantum queries of . It is impossible to achieve this even under model because is a reduced cipher instead of the complete cipher . In the original differential attack, the adversaries are also not able to query the reduced version. They thus analyzed the detailed constructions of the cipher and searched for truncated differentials whose probabilities were high regardless of the value the key took. Inspired by this idea, we consider searching for the truncated differentials with a high probability for most keys.
Since all constructions of the cipher
, except for the private key
k, are public, the function
take the key as the input and is known and determined to the adversaries. Thus, the adversaries have access to the quantum circuit of the unitary operator
Let
be the amount of quantum universal gates in this circuit. The adversaries also have the quantum circuit of every component function
The corresponding amount of gates is
(
,
n). The adversaries have the quantum circuits of
’s. Therefore, they can run Algorithm 1 on
’s without quantum queries. The adversaries can run Algorithm 1 to obtain the differentials of high probability of every
, then by taking a common input difference of part component functions as the input difference, they can obtain a truncated differential having high probability. According to this idea, we propose Algorithm 2 for finding truncated differentials of block ciphers.
The flowchart of Algorithm 2 is presented in
Figure 5. Steps 1–18 of Algorithm 2 are used to determine the high-probability differentials of
for every
,
n. The purpose of steps 19–26 is to choose a difference which is a common input difference of as many
as possible. Algorithm 2 outputs a truncated differential
of
. The symbol “∗” in
b means that the corresponding bits are unpredicted. In a quantum truncated differential attack, the adversaries first choose a polynomial
and a constant
(
), then implement Algorithm 2 to get an output
. According to Theorem 3 which is proven in
Section 3.2, the differential probability of
is greater than
for more than
proportion of keys in
with an overwhelming probability.
Algorithm 2 Quantum algorithm for finding high-probability truncated differentials |
Input: The quantum circuit of , a polynomial and a constant () chosen by the adversaries. Output: a high-probability truncated differential of .
- 1:
Let ; - 2:
Define a set ; - 3:
for , n do - 4:
for , do - 5:
Apply BV algorithm to to get an output , , ; - 6:
Let , ; - 7:
end for - 8:
Solve the linear equation by Gaussian elimination method, obtaining the solution sets for , respectively; - 9:
Compute the set ; - 10:
Let ; - 11:
for do - 12:
Let ; - 13:
end for - 14:
for do - 15:
Let ; - 16:
end for - 17:
Let ; - 18:
end for - 19:
for , 1 do - 20:
if then - 21:
if there are d different subscripts , s.t. then - 22:
Choose at random a vector , and for , n, let where denotes the bit appended to a in the set , i.e., ; - 23:
Let , and return ; - 24:
end if - 25:
end if - 26:
end for - 27:
Return “No”;
|
To implement steps 21-22, the adversaries traverse the variables , in sequence. For , , , , ⋯, , n, Algorithm 2 needs to compute the intersection of the sets , . If the intersection contains nonzero vectors, Algorithm 2 randomly chooses a nonzero vector and outputs it.
In order to demonstrate the feasibility of the output truncated differential
, it is necessary to compute the ratio of signal to noise
. To this end, we first calculate the parameter
, which is equal to the average count that every plaintext pair contributes. There are
d bits of the difference
b predicted, therefore a total of
output differences matching the truncated difference
b. In the counting process, the ciphertexts of a fixed pair of plaintexts are decrypted using
L candidate subkeys. The resulting
L output differences can be viewed as random vectors. Therefore, every plaintext pair contributes
counts on average. Then
This value is greater than one because of the condition
in the step 14 of Algorithm 2. After obtaining the output
, the adversaries can utilize it to find the right subkey involved in the last
rounds, similar to the traditional truncated differential attack. This attack should work for at least
proportion of keys in
. Even if “No” is output, the adversaries can adjust the polynomial
and
to increase the success probability.
3.2. Analysis of Algorithm 2
We analyze the correctness and efficiency of Algorithm 2. Theorem 3 indicates the correctness of Algorithm 2.
Theorem 3. Suppose Algorithm 2 outputs , then with an overwhelming probability, there is a subset satisfying that , and for every key ,That is, the differential probability of is greater than σ for more than proportion of keys in . Proof. b has
d predicted bits, whose subscripts are
,
. Appending
m zeros after the vector
a gives an
-bit vector
,
. Since
,
, it holds that
The
-bit vector
can be viewed as the output of Algorithm 2 when it is applied to
for all
. From Theorem 1, the probability that
holds is greater than
. If the above inequality holds, then the number of
z that satisfies
for both
and
is greater than
. Likewise, the number of
z satisfying Equation (
3) for all
is greater than
. By induction, the number of
z that satisfies Equation (
3) for all
is more than
. Therefore, the probability that
holds is greater than
, which is equivalent to
Let
Equation (
4) indicates that
. Here
is the statistical expectation of
and the variable
k follows the uniform distribution of
. Therefore, when Equation (4) holds, we have
for any polynomial
. This is because, if not, then
, which means
This leads to a contradiction. Thus, as long as Equation (
4) holds, the proportion of the keys satisfying
in
must be greater than
. Let
S be a set of all such keys. We have
, and for every
,
Let
. Since
, the probability that Equation (
4) holds is larger than
. Therefore, with an overwhelming probability, there is a subset
satisfying that
, and for every
,
which means that the differential probability of
is greater than
for more than
proportion of keys in
□
When implementing a truncated differential attack, the adversaries first choose a polynomial
and a parameter
, then run Algorithm 2 to get
. The polynomial
is used to characterize the expected proportion of keys under which
has high probability. The parameter
is used characterize the expected differential probability. According to Theorem 3, with an overwhelming probability, for at least
proportion of keys in
the probability of
is greater than
. Then the adversaries can use
to determine the subkey of the last
rounds as in a traditional truncated differential attack. This attack works for at least the
proportion of keys in
. The amount of plaintext pairs required in the counting process is determined by the value of
. Based on experimental observations, about 20 to 40 appearances of right plaintext pairs are enough [
49]. Therefore, about
plaintext pairs are sufficient.
For analyzing the complexity, we first calculate the amounts of universal gates and qubits required and then estimate the complexity of the classical computing involved.
In Algorithm 2, BV algorithm is performed on each
for
times (
,
). Every call requires the execution of
Hadamard gates and one quantum circuit of
. Thus, each call requires
quantum universal gates. The total number of Hadamard gates required for Algorithm 2 is
Since it holds that
the total number of times Algorithm 2 needs to execute the quantum circuit of
is
. In summary, Algorithm 2 requires
universal gates in total. This number is a polynomial of
n and
m.
Classical computing part is to solve the linear system
for each
,
n and
. The adversaries need to solve a total of
systems, and every system has
equations and
n unknowns. Therefore, the classical complexity of this part is
. Applying BV algorithm to every
requires
qubits. Thus, Algorithm 2 requires
qubits in total.
The parameters involved in Algorithm 2 include the constant
, polynomial
, blocksize
n and key length
m. For the convenience of parameter analysis, we list the quantum resources required for Algorithm 2 in
Table 2, then analyze the influence of these parameters on the complexity of Algorithm 2.
The parameter
is chosen by the adversary and satisfies
.
is the lower bound of the probability of truncated differentials desired by the adversary. Since truncated differentials have at least one predicted bit, the probability of any truncated differential of a random permutation is no more than
. Taking
is sufficient to ensure that the truncated differential output by Algorithm 2 is an effective differential. When more than one bit is predicted, the value of
can take a smaller value. Therefore, the coefficient
in
Table 2 usually can be seen as a small constant.
The parameter is a polynomial chosen by the adversary. It characterizes the expected proportion of keys under which the output differential has high probability. The larger the value of , the more keys are feasible for the attack, but at the same time, the complexity also increases. The adversary can choose based on the expected key proportion and acceptable complexity. Especially, can be chosen as a constant , then the number of Hadamard gates is . The number of times needs to be executed quantumly is and the number of qubits is . Here we omit m because usually .
The values of parameters
depend on which block cipher is attacked. For common non-lightweight block ciphers, the value of the blocksize
n is generally between 128 and 256, the value of the key length
m is generally between 128 and 256. For common lightweight block ciphers, the value of the blocksize
n is generally between 32 and 128, the value of the key length
m is generally between 64 and 256. We take
,
as an example and list the values of these parameters of several block ciphers and the corresponding complexity of Algorithm 2 in
Table 3.
At present, the largest quantum chip is released by IBM, supporting over 1000-plus qubits [
60]. IBM quantum platform supports the quantum circuits of 100-plus qubits. According to
Table 3, it is unfeasible to completely implement or simulate Algorithm 2 on a block cipher.
3.3. Simulation
In this subsection, we simulate Algorithm 2 acting on a simple Boolean function. This demonstrates the practicality and correctness of Algorithm 2. Specifically, we choose a Boolean function
, whose truth table in presented in
Table 4. Let
. To simulate Algorithm 2 with Qiskit, we need to construct the quantum circuit of each component function
(
), then apply BV algorithm on each
to find high-probability differentials of
. Using LIGHTER-R tool or manual deduction it is easy to obtain the construction of quantum circuits of all component functions
. The code of the simulation is presented on GitHub [
61].
After constructing the quantum circuit of
on Qiskit, we use the draw method to generate the quantum circuit diagram of BV algorithm acted on
. The circuit diagram is shown in
Figure 6. The symbol
M denotes the measurement on the computational basis states. We add a dotted box to mark the part of quantum circuit implementing
.
The measurement results simulated by Qiskit are shown in
Figure 7. They only take four values: 1100, 1110, 1101 and 1111. Then solving the equation
gives a fundamental solution system:
. The solution set of the above equation is
. The solution set of the equation
is
. According to step 9 of Algorithm 2, we let
.
By employing a similar method, we construct the quantum circuit of
on Qiskit and use the draw method to generate the quantum circuit diagram of BV algorithm acted on
. The circuit diagram is shown in
Figure 8. We add a dotted box to mark the part of quantum circuit implementing
.
The measurement results simulated by Qiskit are shown in
Figure 9. They only take four values: 0110, 1110, 0111 and 1111. Solving the equation
gives a fundamental solution system:
. The solution set of the above equation is
. The solution set of the equation
is
. According to step 9 of Algorithm 2, we let
.
Similarly, we construct the quantum circuit of
on Qiskit and use the draw method to generate the quantum circuit diagram of BV algorithm acted on
. The circuit diagram is shown in
Figure 10. We add a dotted box to mark the part of quantum circuit implementing
.
The measurement results simulated by Qiskit are shown in
Figure 11. They only take one value: 0111. Solving the equation
gives a fundamental solution system:
. The solution set of this equation is
. The solution set of the equation
is
. According to step 9 of Algorithm 2, we let
Then we construct the quantum circuit of
on Qiskit and use the draw method to generate the quantum circuit diagram of BV algorithm acted on
. The circuit diagram is shown in
Figure 12. We add a dotted box to mark the part of quantum circuit implementing
.
The measurement results simulated by Qiskit are shown in
Figure 13. All vectors in
appear in the measurement results. The system of linear equations
has only one solution
. The solution set of the system of linear equations
is the empty set, that is,
. According to step 9 of Algorithm 2, we let
Since , and , Algorithm 2 chooses and let , then output . It is easy to verify that ∼b holds for all . The probability of the truncated differential is one. This indicates that Algorithm 2 can indeed find high-probability truncated differentials.
5. Results
We apply BV algorithm to truncated differential cryptanalysis and boomerang cryptanalysis and propose two quantum algorithms for finding high-probability truncated differentials and boomerang distinguishers, respectively.
For truncated differential cryptanalysis, we propose Algorithm 2 for finding truncated differentials that have high probability. Given the quantum circuit of a block cipher
, Algorithm 2 takes the key as a part of the input and repeats running BV algorithm on each component function of
to find truncated differentials of each
, then obtains a truncated differential of
by searching for a common input difference of as many component functions as possible. When executing Algorithm 2, the adversary first chooses parameters
and
, Algorithm 2 is then run to obtain a truncated differential. We use quantum information theory and probability theory to rigorously prove that the probability of the truncated differential output by Algorithm 2 must be greater than
for more than
proportion of keys in
. Algorithm 2 can be run by Q1 quantum adversaries and the complexity is at polynomial level. We take
as an example and list numbers of universal gates and qubits of Algorithm 2 under different values of
in
Table 7. The values in
Table 7 are obtained according to Equations (5) and (6).
For boomerang cryptanalysis, we propose Algorithm 3 for finding boomerang distinguishers. Given the quantum circuit of a block cipher
, Algorithm 3 traverses the value of
from 1 to
and calls Algorithm 2 to find the truncated differentials of
and
, respectively, where
. When executing Algorithm 3, the adversary also needs to choose parameters
and
, then runs Algorithm 3 to obtain a boomerang distinguisher of
. The probability of generating a right quadruple of this boomerang distinguisher is greater than
for more than
proportion of keys in
. Algorithm 3 can be run by Q1 quantum adversaries and the complexity is at polynomial level. We take
as an example, and list number of universal gates and qubits of Algorithm 3 under different values of
in
Table 8. The values in
Table 8 are obtained according to Equations (7) and (8).
Both Algorithm 2 and Algorithm 3 can be executed in
model. As shown in
Table 7 and
Table 8, the quantum complexity of both algorithms are at the polynomial level. They show the superiority of quantum computing in cryptanalysis.
6. Conclusions
In this study, we further explored the superior computing power of quantum algorithms when applied to the field of cryptanalysis. We used BV algorithm to enhance two variants of differential cryptanalysis: truncated differential cryptanalysis and boomerang cryptanalysis. We constructed two quantum algorithms that can find truncated differentials and boomerang distinguishers of block ciphers. We prove with an overwhelming probability, that the truncated differentials or boomerang distinguishers found by our algorithms have a high probability for the most keys in the key space.
The complexity of our algorithms is at the polynomial level and adversaries can realize them in Q1 model. Compared to many proposed quantum attack algorithms [
14,
15,
16,
18,
19,
46] which demand quantum queries, our algorithms are more practical for realization. Classical automatic tools for searching truncated differentials with high probability or boomerang distinguishers were unable to consider all the details of S-boxes when the S-boxes were not small-scale. For example, in the case of the widely used 8-bit S-boxes, the classical searching tools can only work for extremely few rounds. In comparison, our algorithms fully utilize the strengths of quantum computing to compensate for this shortcoming. Their quantum circuits strictly compute the S-boxes when performing the operator
and only have polynomial quantum gates. Moreover, classical truncated differential and boomerang attacks are unable to consider the influence of key scheduling in the attack model of single-key, but the proposed algorithms incorporate the key scheduling into the operator
and thus fully consider the impact of the key scheduling. We believe the study of quantum cryptanalysis is crucial for the design of quantum-secure cryptosystems in order to prepare for the arrival of quantum computers.
For further research, reducing the quantum complexity of the proposed algorithms is a meaningful direction. It would also be interesting to explore the possible applications of quantum algorithms in other cryptanalytic tools such as integral and algebraic attacks. Quantum key distribution technique uses quantum systems to generate and distribute keys. The quantum algorithms proposed in this paper are used to attack traditional block ciphers that encrypt classical information. Investigating a combination of the proposed algorithms with quantum key distribution technique may be an interesting research direction.