Quantum computers leverage the properties of quantum mechanics to utilize qubits that can exist in both 0 and 1 states simultaneously, providing powerful computational capabilities for specific problems. Shor’s algorithm efficiently solves the integer factorization problem for large numbers [
1], threatening the security of public-key cryptography such as RSA. Grover’s algorithm efficiently addresses the problem of finding a desired item in an unsorted database. While classical algorithms take
time complexity, Grover’s algorithm solves it in
time complexity [
2]. This greatly accelerates brute force attacks for finding keys in symmetric key algorithms (e.g., AES). The advent of quantum computers significantly threatens existing cryptographic systems, including public-key cryptography and symmetric-key cryptography. In response, NIST has launched the Post-Quantum Cryptography Standardization competition to find replacements for current cryptographic standards. NIST has also proposed the cost of Grover’s algorithm attack, using the maximum depth (MAXDEPTH) of AES as a metric to assess the quantum security strength of block ciphers. To estimate Grover’s algorithm attack cost for a target cipher and verify the post-quantum security levels proposed by NIST, it is necessary to implement the cipher as a quantum circuit. Quantum circuits are required inside the oracle of Grover’s algorithm. Optimized quantum circuits allow for a more accurate determination of post-quantum security levels. Motivated by this, many prior studies have conducted optimized implementations of various ciphers as quantum circuits, such as LSH [
3,
4], PIPO [
5], SPEEDY [
6], and so on [
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18].
This paper presents the implementation of a quantum circuit for
. We implement the
algorithm on a quantum computer with low circuit complexity and provide a detailed explanation of the various optimization techniques applied to achieve this. We propose a method to ancilla qubits to clean
through inverse operations and to reuse them in the next iteration. During this process, we perform inverse operations in parallel with subsequent operations to minimize the increase in depth. Additionally, we follow a qubit update method, where if the pre-update value of an updated qubit is needed, we use the updated value in the next operation and then apply the inverse operation to restore the pre-update value. Using this method, we significantly reduce the number of ancilla qubits while only slightly increasing the overall depth. Consequently, we reduce the circuit complexity, calculated as the product of time and space complexity (DW-cost = qubit × T-depth), for
. We provide the estimated resources for the optimized quantum circuit. To the best of our knowledge, this is the first quantum circuit implementation for
. Therefore, it is difficult to compare the optimization results of our quantum circuit with previous
results. We perform quantum circuit optimization based on the original reference implementation of
. This
quantum circuit can be used to operate Grover’s algorithm to estimate resources. Therefore, this paper will serve as the foundation for future implementations of the
algorithm in quantum circuits. Further optimization of future
quantum circuits will help us more accurately assess the post-quantum security of the algorithm. The structure of this paper is as follows: in
Section 2, related research on NIST’s PQC Standards Competition and quantum computing is written to help understand the paper.
Section 3 explains the implementation of the proposed
quantum circuit. This section describes the optimization techniques applied to each
function in detail.
Section 4 estimates and analyzes the resources required for the proposed quantum circuit. We use the projectQ [
19] tool to analyze resources and verify implementation results. The DW cost is calculated and written based on the estimated resources. Finally,
Section 5 concludes the paper.
1.1. Our Contribution
1.1.1. First Quantum Circuit for
To the best of our knowledge, this is the first quantum circuit for
. The
algorithm has been implemented in various optimized implementations across different hardware and software environments [
20,
21,
22]. However, there has been no quantum circuit result suitable for a quantum computer environment. Although optimizations such as memory optimization have been studied for
[
23], we implemented the quantum circuit based on the original reference code. We present an optimization direction for the
quantum circuit and establish a basis for assessing initial post-quantum security. These research results will serve as a foundation for future implementations of
quantum circuits.
1.1.2. Qubit Reuse through Inverse Computation
We propose a method where, after using ancilla qubits in a clean state, the dirty qubit is returned to a clean state through inverse operations, allowing them to be reused in subsequent iterations. In SHA-256, dirty ancilla qubits that have been used can be reset to a clean state through inverse operations, enabling reuse in all loops. Using this method, we reduced the number of qubits by 8128 in SHA-256 within with a slight increase in depth (approximately depth 6). In the Salsa function within SMix, we avoided using ancilla qubits for intermediate value storage during the ‘Operation on columns’ and ‘Operate on rows’ steps. Instead, we updated the intermediate values directly into the inputs. When the pre-update values of the updated qubits were needed for subsequent operations, we used the updated values in the following operations and then applied inverse operations to restore the pre-update values.
1.1.3. Parallel Structures in SHA-256 and Salsa20/8
We designed the internal operations to be as parallel as possible to reduce the depth of the quantum circuit. In SHA-256, we reset the used ancilla qubits to a clean state through inverse operations and designed the circuit to reuse them in all loops. However, adding inverse operations increases the depth of the quantum circuit. To minimize the impact of these inverse operations on the circuit depth, we implemented them to operate in parallel with subsequent operations. Similarly, within the salsa function, the inverse operations that restore the updated qubits to their pre-update state and the internal additions operate partially in parallel with subsequent operations. Therefore, while inverse operations were added to reduce the number of qubits, they do not significantly affect the overall depth.
1.1.4. Optimized Quantum Circuit with Low Complexity
We significantly reduced the number of ancilla qubits. To achieve this, we implemented additional operations in parallel so that the quantum circuit depth is minimally affected. We efficiently implemented into a quantum circuit by reducing the ancilla qubits and depth. These results demonstrate an optimized circuit complexity (DW cost) calculated as the product of time and space complexity.