Next Article in Journal
Reduced Supply in the Organ Donor Market and How 3D Printing Can Address This Shortage: A Critical Inquiry into the Collateral Effects of Driverless Cars
Previous Article in Journal
Choice between Surgery and Conservative Treatment for Patients with Lumbar Spinal Stenosis: Predicting Results through Data Mining Technology
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Grover on Korean Block Ciphers

Division of IT Convergence Engineering, Hansung University, Seoul 02876, Korea
*
Author to whom correspondence should be addressed.
Appl. Sci. 2020, 10(18), 6407; https://doi.org/10.3390/app10186407
Submission received: 1 August 2020 / Revised: 4 September 2020 / Accepted: 11 September 2020 / Published: 14 September 2020
(This article belongs to the Section Quantum Science and Technology)

Abstract

:
The Grover search algorithm reduces the security level of symmetric key cryptography with n-bit security level to O ( 2 n / 2 ) . In order to evaluate the Grover search algorithm, the target block cipher should be efficiently implemented in quantum circuits. Recently, many research works evaluated required quantum resources of AES block ciphers by optimizing the expensive substitute layer. However, few works were devoted to the lightweight block ciphers, even though it is an active research area, nowadays. In this paper, we present optimized implementations of every Korean made lightweight block ciphers for quantum computers, which include HIGHT, CHAM, and LEA, and NSA made lightweight block ciphers, namely SPECK. Primitive operations for block ciphers, including addition, rotation, and exclusive-or, are finely optimized to achieve the optimal quantum circuit, in terms of qubits, Toffoli gate, CNOT gate, and X gate. To the best of our knowledge, this is the first implementation of ARX-based Korean lightweight block ciphers in quantum circuits.

1. Introduction

As the Internet of Things (IoT) technology gets developed, a number of wearable and smart devices are gradually spreading through people’s life [1]. Between these IoT devices, abundant data, from simple sensor data to even sensitive personal data, are being exchanged and processed. In order to protect these sensitive data, the exchange process of the data must be secured properly. To achieve the security, cryptographic algorithms must be applied to the data. However, applying the cryptographic algorithm requires resources, including computational power and memory. Most of the IoT devices do not have enough resources in order to apply cryptographic algorithms of conventional computers since most of them are equipped with low computational power and small memory footprint.
In order to resolve this hard condition, lightweight cryptography has been actively studied [2]. Unlike classical cryptography, a lightweight cryptography is designed for low-end devices. Most lightweight cryptography focuses on using resources efficiently to operate in the resource-constrained devices. However, as a cryptography, it is still important to maintain security even from the potential attacks using not only conventional computers, but also the upcoming quantum computers.
The advent of quantum computers and quantum algorithms has dramatically changed the cryptography community. The most well-known modern public key cryptography, such as RSA and Elliptic Curve Cryptography (ECC), are based on the difficulties of factorization and discrete algebra problem [3]. However, Shor’s algorithm can perform prime number factorization efficiently, making RSA and ECC vulnerable [4].
In the field of symmetric key cryptography, the impact of quantum computers is not as critical as the case of the public key cryptography. The Grover search algorithm can be used to find the n-bit secret key at the speed of n , which is the most effective quantum attack method for block ciphers [5]. Applying the Grover search algorithm to block ciphers is the most efficient way to measure the security level of block ciphers against attacks from quantum computers. For this reason, not only the Grover’s algorithm but also the cryptography must be implemented with a quantum circuit for cryptanalysis. Since the development of quantum computer is a rudimentary stage, finding the optimal quantum resource for the target algorithm is one of the most important research fields.
In order to estimate the quantum resources, a number of block cipher implementations have been investigated [6,7,8,9]. Grassl et al. estimated the quantum resource required for AES block cipher to apply the Grover search algorithm [6]. Afterward, Langenberg et al. and Jaques et al. found more optimal substitute layer design in quantum circuits than Grassl et al. [7,8]. Recently, Anand et al. implemented the SIMON in quantum gates [9], which is a block cipher developed by the National Security Agency (NSA) to support the hardware environment [10].
In this paper, we implemented SPECK and every Korean lightweight block cipher for the quantum resource estimation. To optimize the quantum circuit, functions, such as the key scheduling and the round functions, were optimized by simultaneously calculating results. In addition, the number of qubits was reduced by efficiently arranging the order of operations and the order of objects. Target ciphers are ARX-based structures designed with Addition, Rotation, and XOR operations.

1.1. Contribution

1.1.1. Optimized Implementation of ARX-Based Block Ciphers in Quantum Gates

Quantum gates for AES block ciphers have been actively studied. However, only a few works were devoted to lightweight ARX-based block ciphers. In this paper, we implemented four different ARX-based block ciphers and presented optimized implementations to reduce required qubits.

1.1.2. First Quantum Implementation of ARX-Based All Korean Block Ciphers and In-Depth Analysis

Korean block ciphers, such as LEA, HIGHT, and CHAM are efficiently implemented in quantum gates. This is the first implementation of Korean block ciphers in quantum gates. We analyzed the implementations and show the security against the quantum computer and their features.

1.1.3. Quantum Resource Estimation between Software-Oriented and Hardware-Oriented Block Ciphers

The architecture of block cipher is largely divided into software-oriented (i.e., SPECK) and hardware-oriented (i.e., SIMON). We compared both block ciphers in quantum gates and estimated the quantum security.
The remainder of this paper is organized as follows. In Section 2, target block ciphers, quantum implementations, and quantum algorithms are given. In Section 3, proposed quantum implementations for block ciphers are given. In Section 4, the evaluation of proposed quantum implementation is presented. Finally, Section 5 concludes the paper.

2. Related Works

2.1. Notation

In this paper, the following notations are commonly used, and Table 1 explains its meaning.

2.2. Target Block Ciphers

2.2.1. Hight

In CHES’06, ultra lightweight block cipher HIGHT was presented [11]. HIGHT is a 64-bit block cipher with 128-bit keys. Eight whitening keys and 128 subkeys, 8-bit respectively, are generated from the 128-bit key. HIGHT block cipher performs 8-bit wise ARX operations and the encryption/decryption operation consists of 32 rounds. In each round, a 64-bit round key is required, and, in total, 2048-bit of round keys are needed to process a 64-bit block. The parameters for the HIGHT block cipher are shown in Table 2.
The key schedule of HIGHT uses the initial key words K to generate whitening keys W K and round keys R K . The whitening key is used for initial conversion of plain text and final conversion for cipher text. The whitening key is generated as follows:
W K [ i ] = K [ i + 12 ] , 0 i 3 W K [ i ] = K [ i 4 ] , 4 i 7
The connection polynomial of LFSR h is x 7 + x 3 + 1 . The initial internal state value of h is δ 0 = ( s 6 , s 5 , s 4 , s 3 , s 2 , s 1 , s 0 ) = ( 1 , 0 , 1 , 1 , 0 , 1 , 0 ) . For 1 i 127 , δ i is generated as follows and used for round key generation:
s i + 6 = s i + 2 s i 1 δ i = ( s i + 6 , s i + 5 , s i + 4 , s i + 3 , s i + 2 , s i + 1 , s i )
Round key RK is generated as follows:
for i = 0 to 7 : for j = 0 to 7 : R K [ 16 · i + j ] = K [ j i mod 8 ] δ 16 · i + j for j = 0 to 7 : R K [ 16 · i + j + 8 ] = K [ ( j i mod 8 ) + 8 ] δ 16 · i + j + 8
Before performing the round function, the initial conversion of plaintext T using four whitening keys W K is performed in the encryption process, as follows:
X 0 [ i ] = T [ i ] , i = 1 , 3 , 5 , 7 X 0 [ 0 ] = T [ 0 ] W K [ 0 ] X 0 [ 2 ] = T [ 2 ] W K [ 1 ] X 0 [ 4 ] = T [ 4 ] W K [ 2 ] X 0 [ 6 ] = T [ 6 ] W K [ 3 ]
In the round function of HIGHT, auxiliary functions F 0 ( X ) and F 1 ( X ) using left rotation operation are used, and, for 1 i < 32 , the round function is shown in Equation (6):
F 0 ( X ) = ROL 1 ( X ) ROL 2 ( X ) ROL 7 ( X ) F 1 ( X ) = ROL 3 ( X ) ROL 4 ( X ) ROL 6 ( X )
X i [ j ] = X i 1 [ j 1 ] , j = 1 , 3 , 5 , 7 X i [ 0 ] = X i 1 [ 7 ] ( F 0 ( X i 1 [ 6 ] ) R K [ 4 i 1 ] ) X i [ 2 ] = X i 1 [ 1 ] ( F 0 ( X i 1 [ 0 ] ) R K [ 4 i 4 ] ) X i [ 4 ] = X i 1 [ 3 ] ( F 0 ( X i 1 [ 2 ] ) R K [ 4 i 3 ] ) X i [ 6 ] = X i 1 [ 5 ] ( F 0 ( X i 1 [ 4 ] ) R K [ 4 i 2 ] )
In the last round i = 32 , the F 1 ( X ) is also used, and the output positions of the input values are not changed as follows:
X 32 [ i ] = X 31 [ i ] , i = 0 , 2 , 4 , 6 X 32 [ 1 ] = X 31 [ 1 ] ( F 1 ( X 31 [ 0 ] ) R K [ 124 ] ) X 32 [ 3 ] = X 31 [ 3 ] ( F 0 ( X 31 [ 2 ] ) R K [ 125 ] ) X 32 [ 5 ] = X 31 [ 5 ] ( F 1 ( X 31 [ 4 ] ) R K [ 126 ] ) X 32 [ 7 ] = X 31 [ 7 ] ( F 0 ( X 31 [ 6 ] ) R K [ 127 ] )
After executing all round functions, the ciphertext C is generated by the final conversion using the whitening key, and the final conversion is shown in Equation (8):
C [ i ] = X 32 [ i ] , i = 1 , 3 , 5 , 7 C [ 0 ] = X 32 [ 0 ] W K [ 4 ] C [ 2 ] = X 32 [ 2 ] W K [ 5 ] C [ 4 ] = X 32 [ 4 ] W K [ 6 ] C [ 6 ] = X 32 [ 6 ] W K [ 7 ]
Key schedule and round function structure of HIGHT are shown in Figure 1.

2.2.2. CHAM

In ICISC’17, a family of lightweight block ciphers CHAM was announced by the Attached Institute of ETRI [12]. The family consists of three ciphers: including CHAM-64/128, CHAM-128/128, and CHAM-128/256. The CHAM block ciphers are of the generalized 4-branch Feistel structure based on ARX operations.
In ICISC’19, the revised version of CHAM block cipher was presented [13]. In order to prevent new related-key differential characteristics and differentials of CHAM using a SAT solver, the numbers of rounds of CHAM-64/128, CHAM-128/128, and CHAM-128/256 are increased from 80 to 88, 80 to 112, and 96 to 120, respectively. Table 3 shows the parameters of the block ciphers CHAM.
By performing the key schedule on the initial key words K = { K [ 0 ] , K [ 1 ] , , K [ m 1 ] } , generates round key R K = { R K [ 0 ] , R K [ 1 ] , , R K [ 2 m 1 ] } for use in the i-th round for 0 i < r . The key schedule is shown in Equation (9) below, where 0 i < m :
R K [ i ] = K [ i ] ROL 1 ( K [ i ] ) ROL 8 ( K [ i ] ) R K [ ( i + m ) 1 ] = K [ i ] ROL 1 ( K [ i ] ) ROL 11 ( K [ i ] )
If the round key R K is generated through key scheduling, the plaintext T = { X 0 [ 0 ] , X 0 [ 1 ] , X 0 [ 2 ] , X 0 [ 3 ] } is encrypted by repeating the round function in the following two cases.
If i from the i-th round for 0 i < r is odd, the upper function is called. If the i is even, then the lower function is called:
X i + 1 [ j ] = X i [ j + 1 ] , ( 0 j 2 ) X i + 1 [ 3 ] = ROL 8 ( ( X i [ 0 ] i ) ( ROL 1 ( X i [ 1 ] ) R K [ i mod 2 m ] ) )
In the rest of the cases, the following function applies:
X i + 1 [ j ] = X i [ j + 1 ] , ( 0 j 2 ) X i + 1 [ 3 ] = ROL 1 ( ( X i [ 0 ] i ) ( ROL 8 ( X i [ 1 ] ) R K [ i mod 2 m ] ) )
Key schedule and round function structure of CHAM are shown in Figure 2 and Figure 3.

2.2.3. LEA

In WISA’13, a lightweight block cipher LEA was presented [14]. LEA is a 128-bit block cipher supporting three key lengths, i.e., 128-bit, 192-bit, and 256-bit. LEA–128, LEA-192, and LEA-256 require 24, 28, and 32 rounds, respectively. In each round, 192-bit round keys are required. The word size is 32-bit and primitive operations are 32-bit wise addition, rotation, and exclusive-or. The parameters for the LEA block cipher are shown in Table 4.
The key schedule of the LEA uses constant value δ representing the ASCII codes of ‘L,’ ‘E,’ and ‘A’, and the key schedule is slightly different depending on the parameters. The key schedule of LEA-128 for 0 i < 24 is as follows:
δ [ 0 ] = 0 x c 3 e f e 9 d b , δ [ 1 ] = 0 x 44626 b 02 δ [ 2 ] = 0 x 79 e 27 c 8 a , δ [ 3 ] = 0 x 78 d f 30 e c δ [ 4 ] = 0 x 715 e a 49 e , δ [ 5 ] = 0 x c 785 d a 0 a δ [ 6 ] = 0 x e 04 e f 22 a , δ [ 7 ] = 0 x e 5 c 40957
K [ 0 ] = ROL 1 ( K [ 0 ] ROL i ( δ [ i mod 4 ] ) ) K [ 1 ] = ROL 3 ( K [ 1 ] ROL i + 1 ( δ [ i mod 4 ] ) ) K [ 2 ] = ROL 6 ( K [ 2 ] ROL i + 2 ( δ [ i mod 4 ] ) ) K [ 3 ] = ROL 11 ( K [ 3 ] ROL i + 3 ( δ [ i mod 4 ] ) ) R K i = ( K [ 0 ] , K [ 1 ] , K [ 2 ] , K [ 1 ] , K [ 3 ] , K [ 1 ] )
Unlike the key schedule, the round function is performed as follows for 0 i < r regardless of the parameter for the plaintext P = { X 0 [ 0 ] , X 0 [ 1 ] , X 0 [ 2 ] , X 0 [ 3 ] } :
X i + 1 [ 0 ] = ROL 9 ( ( X i [ 0 ] R K i [ 0 ] ) ( X i [ 1 ] R K i [ 1 ] ) ) X i + 1 [ 1 ] = ROL 5 ( ( X i [ 1 ] R K i [ 2 ] ) ( X i [ 2 ] R K i [ 3 ] ) ) X i + 1 [ 2 ] = ROL 3 ( ( X i [ 2 ] R K i [ 4 ] ) ( X i [ 3 ] R K i [ 5 ] ) ) X i + 1 [ 3 ] = X i [ 0 ]
Key schedule and round function structure of LEA are shown in Figure 4 and Figure 5.

2.2.4. SPECK

In 2013, NSA released two lightweight block ciphers, SPECK and SIMON, for the low-end devices [10]. SPECK has been implemented in order to perform efficiently in the software environment. The SIMON, on the other hand, has been implemented and optimized for hardware. Although these two ciphers are considered sisters, SIMON has already been designed as quantum circuit [9]. For this reason, this paper only covers quantum circuit implementation and optimization for SPECK.
SPECK takes the form of block cipher and is implemented with an ARX structure that consists of simple operations such as addition, rotation, and bit-wise exclusive operation. SPECK is also implemented in various parameters to provide different levels of security, which are shown in Table 5.
A key schedule gets processed in order to generate a round key R K , which will be used in each round. The initial key words are K = { K [ 0 ] , l [ 0 ] , , l [ m 2 ] } , and the following key schedule is performed for 0 i < r , and the new key value R K = { K [ 0 ] , K [ 1 ] , , K [ r 1 ] } is used as the round key. α and β are 7 and 2 when the size of the block is 32-bit, respectively. For the rest of the block size, α and β are 8 and 3, respectively:
l [ i + m 1 ] = ( K [ i ] ROR α ( l [ i ] ) ) i K [ i + 1 ] = ROL β ( K [ i ] ) l [ i + m 1 ]
During the round function of SPECK with the block size of 2 n , for 0 i < r , a 2 n -bit ciphertext word is generated using an n-bit round key for a 2n-bit ( X [ 0 ] , X [ 1 ] ) input word:
X [ 1 ] = ( ROR α ( X [ 1 ] ) X [ 0 ] ) R K [ i ] X [ 0 ] = ROL β ( X [ 0 ] ) X [ 1 ]
Key schedule and encryption of SPECK in case of m = 2 are shown in Figure 6.

2.3. Quantum Implementations and Algorithms

2.3.1. Quantum Gates

Quantum computers have several gates that can emulate the classical gates. The two most representative gates are CNOT and Toffoli gates. The CNOT gate performs a NOT gate operation on the second qubit when the first input qubit of the two input qubits is set as one. The NOT gate (i.e., X gate) inverts the state of the qubit. This gate performs the same role as the addition operation on the binary field. The circuit configuration is shown on the left side of Figure 7. The Toffoli gate takes three qubits as input. When the first and second qubits are set to one, the gate performs a NOT gate operation on the last qubit. This serves as an AND operation on the binary field. The circuit configuration for Toffoli gate is shown on the right side of Figure 7.
A lot of works have been done on the addition operation in quantum computers [15,16,17,18]. Among them, Cuccaro et al. suggested the riple-carry addition circuit to achieve the most optimal design by using only one ancillary qubit [15]. For n-bit addition operation, 2 n + 2 qubits, 2 n Toffoli gates, and 4 n CNOT gates are used.

2.3.2. Grover Search Algorithm

The Grover search algorithm is a quantum algorithm that finds specific data for n unsorted data. The classic method requires O ( 2 n ) searches in brute force attack. However, this can be found within O ( 2 n / 2 ) times with the Grover search algorithm. The Grover search algorithm consists of an oracle function and a diffusion operator, as shown in Figure 8.
The oracle function f ( x ) returns 1 if input x is the solution to the search. Otherwise, it returns 0. When f ( x ) = 1 , the sign of the state x is flipped. It then proceeds to the diffusion operator step, which increases the amplitude of the solution. The searching step is as follows: First, the average amplitude is calculated for all data. Second, the difference between the amplitude and the average amplitude of each data are calculated. If the answer to find in the 2-bit input is 10, the status after these two steps is as shown in Figure 9.
After performing the oracle function, the amplitude of the solution has a different sign from other amplitudes. The difference from the average amplitude increases and the difference between the non-answer amplitudes decreases. The Grover search algorithm increases the amplitude probability of the solution by repeating the oracle function and diffusion operators. The status after diffusion operations is given in Figure 10.

2.3.3. Previous Quantum Implementations

Advanced Encryption Standard (AES) is the international block cipher standard [19] and the block cipher is widely used in practice, such as database encryption and network security. For this reason, a number of works focused on quantum resource estimation for the AES block cipher.
Grassl et al. have presented first quantum circuits to implement an exhaustive key search for the AES and analyzed the quantum resources required to carry out such attacks [6]. All three variants of AES (key size 128, 192, and 256 bit) are implemented for the Grover’s quantum algorithm with optimal operations for each layer.
Langenberg et al. presented new quantum circuits for all three AES key lengths. For AES-128, the number of Toffoli gates can be reduced by more than 88% compared to Grassl et al.’s estimates [6], while simultaneously reducing the number of qubits [20].
Previous works of AES have derived the full gate cost by analyzing quantum circuits for the cipher but focused on minimizing the number of qubits. In [8], they have studied the cost of quantum key search attacks under a depth restriction and introduced techniques that reduce the oracle depth, even if it requires more qubits. As part of this work, they released Q# implementations of the full Grover oracle for AES-128, AES-192, and AES-256, including unit tests and code to reproduce their quantum resource estimates.
In [9], the reversible implementation of SIMON block cipher was presented. This block cipher is hardware-oriented suggested by NSA. They have successfully implemented the Grover oracle and Grover diffusion for key search. They have estimated the resources in terms of CNOT, Toffoli, and X gates, which are required to carry out the quantum attack on the block cipher.

3. Proposed Method

In this chapter, we describe the optimized quantum circuit for applying the Grover’s algorithm to HIGHT, CHAM, LEA, and SPECK block ciphers.
All block ciphers implemented in this paper are composed of modular addition, rotation, and XOR operations based on ARX. In the quantum circuit, the rotation operation can be designed without using any gates by changing the order of qubits. Given a = { a 0 , a 1 , a 2 , a 3 } and b = { b 0 , b 1 , b 2 , b 3 } , the operation a 1 is performed. Then, the XOR operation b = b a is performed on the elements of b and the elements of a changed in order by rotation. In this case, since a is { a 1 , a 2 , a 3 , a 0 } after a 1 , it is completed by performing CNOT( a 1 , b 0 ), CNOT( a 2 , b 1 ), CNOT( a 3 , b 2 ), and CNOT( a 0 , b 3 ). In this way, there is no cost for the rotation operation, and the XOR operation can be performed simply with a CNOT gate.
However, for addition operation, Toffoli gates are required, so a more complex circuit is needed than the previous two cases. We used the method of Cuccaro et. al’s ripple carry addition [15]. In order to use the ripple-carry addition circuit, not only the qubits of the calculation target, but also two additional qubits for carry calculation are required. Since the addition of block cipher is the modular addition, the value of highest carry qubit can be ignored. Therefore, the addition operation can be performed only with the initial carry qubit of c 0 . Since this c 0 qubit is initialized to 0 after addition operation, it can be recycled at any time.
The block cipher is largely divided into two steps, including key schedule and round function. In order to reduce the required qubit, an on-the-fly approach is utilized.

3.1. HIGHT

In this section, we describe the proposed HIGHT block cipher in the quantum circuit to apply the Grover search algorithm.

3.1.1. Key Schedule

In order to reduce the use of qubits in HIGHT, rather than generating all the round keys in advance, the key schedule is performed simultaneously during the round. In the key schedule, the δ 0 = { s 6 , s 5 , s 4 , s 3 , s 2 , s 1 , s 0 } is used first, and then a new δ i must be generated for 1 i 127 . At this time, the number of qubits can be saved by recycling the existing qubits. For example, when creating a δ 1 in Equation (2), a new s 7 is generated, and the s 0 is not included in new δ i . Therefore, we do not allocate a new qubit for s 7 , but operate on the existing s 0 and treat it as a new value. The detailed process for this is shown in Algorithm 1.
Algorithm 1 Generate δ i of HIGHT.
Input: δ i 1 = { s ( i + 5 ) % 7 , s ( i + 4 ) % 7 , s ( i + 3 ) % 7 , s ( i + 2 ) % 7 , s ( i + 1 ) % 7 , s i % 7 , s ( i 1 ) % 7 }
Output: δ i
  1: s ( i 1 ) % 7 CNOT( s ( i + 2 ) % 7 , s ( i 1 ) % 7 )
  2: return δ i = { s ( i 1 ) % 7 , s ( i + 5 ) % 7 , s ( i + 4 ) % 7 , s ( i + 3 ) % 7 , s ( i + 2 ) % 7 , s ( i + 1 ) % 7 , s i % 7 }
As mentioned earlier, to reduce the number of qubits, the key schedule is performed simultaneously with the function of the round. Rather than generating all round keys at once, the key schedule is performed in units of 16 keywords. Instead of generating a round key in new qubits, the operation is performed on the initial key K = { K [ 0 ] , K [ 1 ] , , K [ 15 ] } to convert it to round key R K = { R K [ 0 ] , R K [ 1 ] , , R K [ 15 ] } . The detailed process for this is described in Algorithm 2.
Algorithm 2i-th key schedule of HIGHT.
Input: δ 16 · ( i 1 ) , K
Output:K
  1: for j = 0 to 7 do
  2:  Generate δ 16 · ( i 1 ) + j
  3:   R K [ 16 · ( i 1 ) + j ] ADD( δ 16 · ( i 1 ) + j , K [ j i + 1 mod 8 ] )
  4:  Use R K [ 16 · ( i 1 ) + j ] in round function
  5:  Reverse: ADD( δ 16 · ( i 1 ) + j , K [ j i + 1 mod 8 ] )
  6: end for
  7: for j = 0 to 7 do
  8:  Generate δ 16 · ( i 1 ) + j + 8
  9:   R K [ 16 · ( i 1 ) + j + 8 ] ADD( δ 16 · ( i 1 ) + j + 8 , K [ ( j i + 1 mod 8 ) + 8 ] )
  10:  Use R K [ 16 · ( i 1 ) + j + 8 ] in round function
  11:  Reverse: ADD( δ 16 · ( i 1 ) + j + 8 , K [ ( j i + 1 mod 8 ) + 8 ] )
  12: end for
  13: return K = { K [ 0 ] , K [ 1 ] , , K [ 15 ] }
The R K of 16 keywords is used for 4 rounds. After use, R K is initialized to K by reverse operation. In addition, again, the key schedule is performed to generate the round key R K = { R K [ 16 ] , R K [ 17 ] , , R K [ 31 ] } to be used for the next four rounds.

3.1.2. Round Function

In HIGHT, before proceeding to the round function, the plaintext T is initially converted using the whitening key as shown in Equation (4). The quantum circuit design for this is in Algorithm 3.
Algorithm 3 Initial conversion of HIGHT.
Input: T , K
Output: X 0
  1: X 0 [ i ] T [ i ] , i = 1 , 3 , 5 , 7
  2: X 0 [ 0 ] ADD( K [ 12 ] , T [ 0 ] )
  3: X 0 [ 2 ] CNOT( K [ 13 ] , T [ 2 ] )
  4: X 0 [ 4 ] ADD( K [ 14 ] , T [ 4 ] )
  5: X 0 [ 6 ] CNOT( K [ 15 ] , T [ 6 ] )
  6: return X = { X 0 [ 0 ] , X 0 [ 1 ] , , X 0 [ 7 ] }
We optimized the round function by properly specifying the operation target and order in the round function. The detailed process for this is described in Algorithm 4 and explained in detail.
Algorithm 4 Round function of HIGHT.
Input: Round i, X i 1 , R K
Output: X i
  1: First, operation:
  2:   X i 1 [ 0 ] F 0 ( X i 1 [ 0 ] )
  3:   X i 1 [ 0 ] CNOT( R K [ 4 i 4 ] , X i 1 [ 0 ] )
  4:   X i [ 2 ] ADD( X i 1 [ 0 ] , X i 1 [ 1 ] )
  5:   X i 1 [ 0 ] CNOT( R K [ 4 i 4 ] , X i 1 [ 0 ] ) (reverse)
  6:   X i 1 [ 0 ] F 0 _reverse ( X i 1 [ 0 ] )
  7: Second operation:
  8:   X i 1 [ 2 ] F 0 ( X i 1 [ 2 ] )
  9:   X i 1 [ 2 ] ADD( R K [ 4 i 3 ] , X i 1 [ 2 ] )
  10:   X i [ 4 ] CNOT( X i 1 [ 2 ] , X i 1 [ 3 ] )
  11:   X i 1 [ 2 ] ADD( R K [ 4 i 3 ] , X i 1 [ 2 ] ) (reverse)
  12:   X i 1 [ 2 ] F 0 _reverse ( X i 1 [ 2 ] )
  13: Third operation:
  14:   X i 1 [ 4 ] F 0 ( X i 1 [ 4 ] )
  15:   X i 1 [ 4 ] CNOT( R K [ 4 i 2 ] , X i 1 [ 4 ] )
  16:   X i [ 6 ] ADD( X i 1 [ 4 ] , X i 1 [ 5 ] )
  17:   X i 1 [ 4 ] CNOT( R K [ 4 i 2 ] , X i 1 [ 4 ] ) (reverse)
  18:   X i 1 [ 4 ] F 0 _reverse ( X i 1 [ 4 ] )
  19: Fourth operation:
  20:   X i 1 [ 6 ] F 0 ( X i 1 [ 6 ] )
  21:    X i 1 [ 6 ] ADD( R K [ 4 i 1 ] , X i 1 [ 6 ] )
  22:    X i [ 0 ] CNOT( X i 1 [ 6 ] , X i 1 [ 7 ] )
  23:   X i 1 [ 6 ] ADD( R K [ 4 i 1 ] , X i 1 [ 6 ] ) (reverse)
  24:   X i 1 [ 6 ] F 0 _reverse ( X i 1 [ 6 ] )
  25: Last operation:
  26:   X i [ j ] = X i 1 [ j 1 ] , j = 1 , 3 , 5 , 7
  27: return X i = { X i [ 0 ] , X i [ 1 ] , , X i [ 7 ] }
In particular, through the optimization of the auxiliary function F 0 and F 1 , no additional qubit was used, and the use of the CNOT gate was also reduced. First, since the R K must be used immediately after generation, and then returned to the initial K by a reverse operation, the operation of the round function proceeds in the order of generation of the R K .
Second, in order not to use additional qubits, the new X i must operate on the existing X i 1 . However, if you look at the first and third lines of Equation (6) and second line of Algorithm 4, you can see that the value of X ( i 1 ) [0], which is first calculated in the round function, is used again. Thus, X i 1 [ 0 ] value should not be changed. However, X i 1 [ 1 ] is no longer used after calculation. Therefore, by calculating the value of X i [ 2 ] in X i 1 [ 1 ] , no additional qubits were required. The rest of the round function follows the similar procedure. The specific process is presented in Algorithm 4.
The auxiliary functions F 0 and F 1 rotate the input value and then XOR-ing them all. Since input value is 8-bit, if qubits for the generated value are allocated and then XOR-ing the rotation value of input, this requires 8 × 3 = 24 CNOT gates and 8 new qubits. We efficiently optimized this auxiliary function. The desired output was generated by mixing the input values without allocating the qubits for the outputs of F 0 and F 1 . As a result, 21 CNOT gates in F 0 and 24 CNOT gates in F 1 were implemented without additional qubits. The detailed process for F 0 and F 1 functions is presented in Algorithms 5 and 6.
Algorithm 5 F 0 ( X [ i ] ) of HIGHT.
Input: X [ i ]
Output: X n e w [ i ]
  1: CNOT( X [ i ] [ 4 ] , X [ i ] [ 5 ] ) , CNOT( X [ i ] [ 3 ] , X [ i ] [ 4 ] )
  2: CNOT( X [ i ] [ 2 ] , X [ i ] [ 3 ] ) , CNOT( X [ i ] [ 2 ] , X [ i ] [ 0 ] )
  3: CNOT( X [ i ] [ 4 ] , X [ i ] [ 2 ] ) , CNOT( X [ i ] [ 5 ] , X [ i ] [ 2 ] )
  4: X n e w [ i ] [ 4 ] X [ i ] [ 2 ]
  5: CNOT( X [ i ] [ 7 ] , X [ i ] [ 5 ] )
  6: X n e w [ i ] [ 6 ] X [ i ] [ 5 ]
  7: CNOT( X [ i ] [ 6 ] , X [ i ] [ 4 ] )
  8: X n e w [ i ] [ 5 ] X [ i ] [ 4 ]
  9: CNOT( X [ i ] [ 0 ] , X [ i ] [ 3 ] ) , CNOT( X [ i ] [ 1 ] , X [ i ] [ 3 ] )
  10: X n e w [ i ] [ 2 ] X [ i ] [ 3 ]
  11: CNOT( X [ i ] [ 6 ] , X [ i ] [ 1 ] ) , CNOT( X [ i ] [ 7 ] , X [ i ] [ 1 ] )
  12: X n e w [ i ] [ 0 ] X [ i ] [ 1 ]
  13: CNOT( X [ i ] [ 7 ] , X [ i ] [ 0 ] )
  14: X n e w [ i ] [ 1 ] X [ i ] [ 0 ]
  15: CNOT( X [ i ] [ 5 ] , X [ i ] [ 6 ] ) , CNOT( X [ i ] [ 4 ] , X [ i ] [ 6 ] )
  16: CNOT( X [ i ] [ 3 ] , X [ i ] [ 6 ] ) , CNOT( X [ i ] [ 1 ] , X [ i ] [ 6 ] )
  17: X n e w [ i ] [ 7 ] X [ i ] [ 6 ]
  18: CNOT( X [ i ] [ 6 ] , X [ i ] [ 7 ] ) , CNOT( X [ i ] [ 5 ] , X [ i ] [ 7 ] )
  19: CNOT( X [ i ] [ 1 ] , X [ i ] [ 7 ] ) , CNOT( X [ i ] [ 0 ] , X [ i ] [ 7 ] )
  20: X n e w [ i ] [ 3 ] X [ i ] [ 7 ]
  21: return X n e w = { X n e w [ 0 ] , X n e w [ 1 ] , , X n e w [ 7 ] }
In the round function, after using F 0 and F 1 , it should be returned to the original input value. For this, the F 0 _reverse and F 1 _reverse functions should be executed in reverse order of calculation of the F 0 and F 1 functions.
Algorithm 6 F 1 ( X ) of HIGHT.
Input:X
Output: X n e w
  1: CNOT( X [ 3 ] , X [ 4 ] ) , CNOT( X [ 1 ] , X [ 4 ] )
  2: X n e w [ 7 ] X [ 4 ]
  3: CNOT( X [ 2 ] , X [ 3 ] ) , CNOT( X [ 0 ] , X [ 3 ] )
  4: X n e w [ 6 ] X [ 3 ]
  5: CNOT( X [ 1 ] , X [ 2 ] ) , CNOT( X [ 7 ] , X [ 2 ] )
  6: X n e w [ 5 ] X [ 2 ]
  7: CNOT( X [ 0 ] , X [ 1 ] ) , CNOT( X [ 6 ] , X [ 1 ] )
  8: X n e w [ 4 ] X [ 1 ]
  9:b CNOT( X [ 7 ] , X [ 0 ] ) , CNOT( X [ 5 ] , X [ 0 ] )
  10: X n e w [ 3 ] X [ 0 ]
  11: CNOT( X [ 6 ] , X [ 7 ] ) , CNOT( X [ 4 ] , X [ 7 ] )
  12: CNOT( X [ 3 ] , X [ 7 ] ) , CNOT( X [ 2 ] , X [ 7 ] )
  13: CNOT( X [ 0 ] , X [ 7 ] ) , CNOT( X [ 5 ] , X [ 7 ] )
  14: X n e w [ 2 ] X [ 7 ]
  15: CNOT( X [ 0 ] , X [ 6 ] ) , CNOT( X [ 7 ] , X [ 6 ] )
  16: CNOT( X [ 4 ] , X [ 6 ] ) , CNOT( X [ 1 ] , X [ 6 ] )
  17: X n e w [ 1 ] X [ 6 ]
  18: CNOT( X [ 7 ] , X [ 5 ] ) , CNOT( X [ 6 ] , X [ 5 ] )
  19: CNOT( X [ 3 ] , X [ 5 ] ) , CNOT( X [ 0 ] , X [ 5 ] )
  20: X n e w [ 0 ] X [ 5 ]
  21: return X n e w = { X n e w [ 0 ] , X n e w [ 1 ] , , X n e w [ 7 ] }
In the last 32nd round, the round function from Equation (7) is performed. Compared to the previous round functions, shown in Algorithm 4, the biggest difference is that the last round uses auxiliary function, F 1 , while calculating. Therefore, we have omitted the quantum circuit design for the last round since the overall structure is almost identical.
After all the round functions have been performed, the final conversion from Equation (8) gets performed and encryption gets completed. The quantum circuit design for final conversion is also omitted because it is almost identical to the initial conversion from Algorithm 3. The overall quantum circuit for HIGHT is shown in Figure 11.

3.2. CHAM

In this section, we describe the proposed CHAM block cipher in the quantum circuit to apply the Grover search algorithm.

3.2.1. Key Schedule

The key schedule of CHAM has the same structure as the auxiliary functions F 0 and F 1 of HIGHT. It performs ROL 1 , ROL 8 or ROL 1 , ROL 11 operations on initial keywords K, and XOR-ing them all on the K. Therefore, the method of optimizing the auxiliary function of HIGHT was applied to the key schedule of CHAM. The CNOT gate is performed between the qubits storing K to generate an output in which both the K and rotation values of K are XOR-ed. In the key schedule from Equation (9), the first line operation is well optimized without any additional qubits. The detailed process of the first line in Equation (9) is described in Algorithm 7. Not as much as first line operation, the second line operation in Equation (9) has been optimized for using three temporary qubits. The detailed process of key schedule is described in Algorithm 8.
After performing Algorithms 7 or 8 to use R K generated from K, K is required again when generating another round key R K . Therefore, after using the round key, it is necessary to perform a reverse key schedule operation as done in HIGHT.
Algorithm 7 R K [ i ] key schedule of CHAM.
Input: K [ i ]
Output: R K [ i ]
  1: CNOT( K [ i ] [ 0 ] , K [ i ] [ 8 ] ) , CNOT( K [ i ] [ 1 ] , K [ i ] [ 9 ] )
  2: CNOT( K [ i ] [ 2 ] , K [ i ] [ 10 ] ) , CNOT( K [ i ] [ 3 ] , K [ i ] [ 11 ] )
  3: CNOT( K [ i ] [ 4 ] , K [ i ] [ 12 ] ) , CNOT( K [ i ] [ 5 ] , K [ i ] [ 13 ] )
  4: CNOT( K [ i ] [ 6 ] , K [ i ] [ 14 ] ) , CNOT( K [ i ] [ 15 ] , K [ i ] [ 6 ]
  5: for j = 0 to 5 do
  6:  CNOT( K [ i ] [ j + 9 ] , K [ i ] [ j ] ) , R K [ i ] [ j + 1 ] K [ i ] [ j ]
  7: end for
  8: CNOT( K [ i ] [ 7 ] , K [ i ] [ 6 ] ) , R K [ i ] [ 7 ] K [ i ] [ 6 ]
  9: CNOT( K [ i ] [ 8 ] , K [ i ] [ 15 ] ) , R K [ i ] [ 0 ] K [ i ] [ 15 ]
  10: CNOT( K [ i ] [ 8 ] , K [ i ] [ 7 ] ) , R K [ i ] [ 8 ] K [ i ] [ 7 ]
  11: for j = 0 to 6 do
  12:  CNOT( K [ i ] [ j ] , K [ i ] [ j + 8 ] ) , R K [ i ] [ j + 9 ] K [ i ] [ j + 8 ]
  13: end for
  14: return R K [ i ] = { R K [ i ] [ 0 ] , R K [ i ] [ 1 ] , , R K [ i ] [ 15 ] }
Algorithm 8 R K [ i + 8 1 ] key schedule of CHAM.
Input: K [ i ]
Output: R K [ i + 8 1 ]
  1: CNOT( K [ i ] [ 15 ] , temp [ 0 ] ) , CNOT( K [ i ] [ 9 ] , temp [ 0 ] )
  2: CNOT( K [ i ] [ 5 ] , temp [ 1 ] ) , CNOT( K [ i ] [ 15 ] , temp [ 1 ] )
  3: CNOT( K [ i ] [ 4 ] , temp [ 2 ] ) , CNOT( K [ i ] [ 10 ] , temp [ 2 ] )
  4: CNOT( K [ i ] [ 14 ] , K [ i ] [ 15 ] ) , CNOT( K [ i ] [ 4 ] , K [ i ] [ 15 ]
  5: CNOT( K [ i ] [ 9 ] , K [ i ] [ 4 ] ) , CNOT( K [ i ] [ 3 ] , K [ i ] [ 4 ]
  6: R K [ i + 8 1 ] [ 15 ] K [ i ] [ 15 ] , R K [ i + 8 1 ] [ 4 ] K [ i ] [ 4 ]
  7: CNOT( K [ i ] [ 14 ] , K [ i ] [ 9 ] ) , CNOT( K [ i ] [ 8 ] , K [ i ] [ 9 ]
  8: CNOT( K [ i ] [ 13 ] , K [ i ] [ 14 ] ) , CNOT( K [ i ] [ 3 ] , K [ i ] [ 14 ]
  9: R K [ i + 8 1 ] [ 9 ] K [ i ] [ 9 ] , R K [ i + 8 1 ] [ 14 ] K [ i ] [ 14 ]
  10: CNOT( K [ i ] [ 8 ] , K [ i ] [ 3 ] ) , CNOT( K [ i ] [ 2 ] , K [ i ] [ 3 ]
  11: CNOT( K [ i ] [ 13 ] , K [ i ] [ 8 ] ) , CNOT( K [ i ] [ 7 ] , K [ i ] [ 8 ]
  12: R K [ i + 8 1 ] [ 3 ] K [ i ] [ 3 ] , R K [ i + 8 1 ] [ 8 ] K [ i ] [ 8 ]
  13: CNOT( K [ i ] [ 12 ] , K [ i ] [ 13 ] ) , CNOT( K [ i ] [ 2 ] , K [ i ] [ 13 ]
  14: CNOT( K [ i ] [ 7 ] , K [ i ] [ 2 ] ) , CNOT( K [ i ] [ 1 ] , K [ i ] [ 2 ]
  15: R K [ i + 8 1 ] [ 13 ] K [ i ] [ 13 ] , R K [ i + 8 1 ] [ 2 ] K [ i ] [ 2 ]
  16: CNOT( K [ i ] [ 12 ] , K [ i ] [ 7 ] ) , CNOT( K [ i ] [ 6 ] , K [ i ] [ 7 ]
  17: CNOT( K [ i ] [ 1 ] , K [ i ] [ 12 ] ) , CNOT( K [ i ] [ 1 ] , K [ i ] [ 12 ]
  18: R K [ i + 8 1 ] [ 7 ] K [ i ] [ 7 ] , R K [ i + 8 1 ] [ 12 ] K [ i ] [ 12 ]
  19: CNOT( K [ i ] [ 6 ] , K [ i ] [ 1 ] ) , CNOT( K [ i ] [ 0 ] , K [ i ] [ 1 ]
  20: CNOT( K [ i ] [ 11 ] , K [ i ] [ 6 ] ) , CNOT( K [ i ] [ 5 ] , K [ i ] [ 6 ]
  21: R K [ i + 8 1 ] [ 1 ] K [ i ] [ 1 ] , R K [ i + 8 1 ] [ 6 ] K [ i ] [ 6 ]
  22: CNOT( K [ i ] [ 10 ] , K [ i ] [ 11 ] ) , CNOT( K [ i ] [ 0 ] , K [ i ] [ 11 ]
  23: R K [ i + 8 1 ] [ 11 ] K [ i ] [ 11 ]
  24: CNOT(temp [ 0 ] , K [ i ] [ 10 ] ) , CNOT(temp [ 1 ] , K [ i ] [ 0 ] )
  25: R K [ i + 8 1 ] [ 10 ] K [ i ] [ 10 ] , R K [ i ] [ 0 ] K [ i ] [ 0 ]
  26: CNOT(temp [ 2 ] , K [ i ] [ 5 ] )
  27: R K [ i + 8 1 ] [ 5 ] K [ i ] [ 5 ]
  28: return R K [ i + 8 1 ] = { R K [ i + 8 1 ] [ 0 ] , R K [ i + 8 1 ] [ 1 ] , , R K [ i + 8 1 ] [ 15 ] }

3.2.2. Round Function

In the second line of the round function from Equation (10), among the input X i values, the values of X i [ 1 ] , X i [ 2 ] , and X i [ 3 ] are used as new values of X i + 1 , but X i [ 0 ] is not used after calculation. Therefore, the value of X i [ 0 ] in the second line can be used by computing X i + 1 [ 3 ] to save the qubits for a new value.
In the second line of the round function, the constant i is XOR-ed to X i [ 0 ] . This is done by performing the X gate on the qubit according to the position where the bit of i is 1 in X i [ 0 ] . For example, if i = 3 = ( 1 , 1 , 0 , 0 , , 0 ) , X gate is performed on the qubits X 3 [ 0 ] [ 0 ] and X 3 [ 0 ] [ 1 ] .
The round function of CHAM is expressed in Equations (10) and (11). The detailed circuit design process is shown in Algorithm 9, and the overall quantum circuit for CHAM-64/128 is shown in Figure 12.
Algorithm 9 Round function of CHAM.
Input: R K , X i , Round i
Output: X i + 1
  1: if i is odd then
  2:   X i [ 1 ] X i [ 1 ] 1
  3:   X i [ 1 ] CNOT ( R K [ i mod 2 m ] , X i [ 1 ] )
  4:   X i [ 0 ] X gate ( i , X i [ 0 ] )
  5:   X i [ 0 ] ADD ( X i [ 1 ] , X i [ 0 ] )
  6:   X i [ 1 ] CNOT ( R K [ i mod 2 m ] , X i [ 1 ] ) (reverse)
  7:   X i [ 1 ] X i [ 1 ] 1 (reverse)
  8:   X i + 1 [ 3 ] X i [ 0 ] 8
  9:   X i + 1 [ j ] X i [ j + 1 ] , j = 0 , 1 , 2
  10: else
  11:   X i [ 1 ] X i [ 1 ] 8
  12:   X i [ 1 ] CNOT ( R K [ i mod 2 m ] , X i [ 1 ] )
  13:   X i [ 0 ] X gate ( i , X i [ 0 ] )
  14:   X i [ 0 ] ADD ( X i [ 1 ] , X i [ 0 ] )
  15:   X i [ 1 ] CNOT ( R K [ i mod 2 m ] , X i [ 1 ] ) (reverse)
  16:   X i [ 1 ] X i [ 1 ] 8 (reverse)
  17:   X i + 1 [ 3 ] X i [ 0 ] 1
  18:   X i + 1 [ j ] X i [ j + 1 ] , j = 0 , 1 , 2
  19: end if
  20: return X i + 1 = { X i + 1 [ 0 ] , X i + 1 [ 1 ] , X i + 1 [ 2 ] , X i + 1 [ 3 ] }

3.3. LEA

In this section, we describe the proposed LEA block cipher in the quantum circuit to apply the Grover search algorithm.

3.3.1. Key Schedule

In the LEA-128 key schedule from Equation (13), the first round key R K 0 is generated using the initial keywords K and a constant value δ . In addition, the next round key R K 1 generation requires R K 0 and δ . Therefore, in order not to use additional qubits in the key schedule of the LEA, the key schedule and the round function are performed simultaneously by using the round key in the corresponding round function and generating the next round key. The detailed process for this is in Algorithm 10.
Algorithm 10i-th key schedule of LEA-128.
Input: δ , K ( i = 1 ) or R K i 2 ( i > 1 )
Output: R K i 1
  1: K [ 0 ] ADD ( δ [ ( i 1 ) mod 4 ] ( i 1 ) , K [ 0 ] )
  2: K [ 0 ] K [ 0 ] 1
  3: K [ 1 ] ADD ( δ [ ( i 1 ) mod 4 ] ( i ) , K [ 1 ] )
  4: K [ 1 ] K [ 1 ] 3
  5: K [ 2 ] ADD ( δ [ ( i 1 ) mod 4 ] ( i + 1 ) , K [ 2 ] )
  6: K [ 2 ] K [ 2 ] 6
  7: K [ 3 ] ADD ( δ [ ( i 1 ) mod 4 ] ( i + 2 ) , K [ 3 ] )
  8: K [ 3 ] K [ 3 ] 11
  9: return R K i 1 = { K [ 0 ] , K [ 1 ] , K [ 2 ] , K [ 1 ] , K [ 3 ] , K [ 1 ] }

3.3.2. Round Function

In the round function, additional qubits were not used by appropriately specifying the operation order and target. New qubits for X i + 1 from Equation (14) are not allocated, and it is calculated in the X i and treated as a new value X i + 1 . The operation starts from the third line of Equation (14). X i [ 3 ] is used as the value of X i + 1 [ 2 ] because X i [ 3 ] is no longer used. After the third line operation is finished, the value of X i [ 2 ] in the second line is no longer used, so it is used as the new value X i + 1 [ 1 ] . The detailed process for this is in Algorithm 11. The overall quantum circuit for LEA-128 is shown in Figure 13.
Algorithm 11 Round function of LEA-128.
Input: X i , R K , Round i
Output: X i + 1
  1: X i [ 3 ] CNOT ( R K i [ 5 ] , X i [ 3 ] )
  2: X i [ 2 ] CNOT ( R K i [ 4 ] , X i [ 2 ] )
  3: X i [ 3 ] ADD ( X i [ 2 ] , X i [ 3 ] )
  4: X i [ 2 ] CNOT ( R K i [ 4 ] , X i [ 2 ] ) (reverse)
  5: X i + 1 [ 2 ] X i [ 3 ] 3
  6: X i [ 2 ] CNOT ( R K i [ 3 ] , X i [ 2 ] )
  7: X i [ 1 ] CNOT ( R K i [ 2 ] , X i [ 1 ] )
  8: X i [ 2 ] ADD ( X i [ 1 ] , X i [ 2 ] )
  9: X i [ 1 ] CNOT ( R K i [ 2 ] , X i [ 1 ] ) (reverse)
  10: X i + 1 [ 1 ] X i [ 2 ] 5
  11: X i [ 1 ] CNOT ( R K i [ 1 ] , X i [ 1 ] )
  12: X i [ 0 ] CNOT ( R K i [ 0 ] , X i [ 0 ] )
  13: X i [ 1 ] ADD ( X i [ 0 ] , X i [ 1 ] )
  14: X i [ 0 ] CNOT ( R K i [ 0 ] , X i [ 0 ] ) (reverse)
  15: X i + 1 [ 0 ] X i [ 1 ] 9
  16: X i + 1 [ 3 ] X i [ 0 ]
  17: return X i + 1 = { X i + 1 [ 0 ] , X i + 1 [ 1 ] , X i + 1 [ 2 ] , X i + 1 [ 3 ] }

3.4. SPECK

In this section, we describe the proposed SPECK block cipher in the quantum circuit to apply the Grover search algorithm.

3.4.1. Key Schedule

Looking at Equation (15), key words K = { K [ 0 ] , l [ 0 ] , , l [ m 2 ] } are extended to key K = { K [ 0 ] , K [ 1 ] , , K [ r 1 ] } through key schedule. To save the use of qubits, we update the qubits of K [ 0 ] used in the first round and use it as the next round key instead of generating all round key R K . As a result, K [ 0 ] is used as a round key from start to finish. Qubits assigned to the initial keywords K, an element of the key schedule for updating the round key K [ 0 ] , are reused to the end. By recycling the qubits in this way, all round functions can be completed with only the initial keyword qubits. If a round key is generated in K [ 0 ] , the next round key must be generated after executing the round function. For 1 i < r , the detailed process for the key schedule is in Algorithm 12.
Algorithm 12 RK[i] key schedule of SPECK.
Input: K = { K [ 0 ] , l [ 0 ] , , l [ m 2 ] }
Output: R K [ i ]
  1: l [ ( i 1 ) % ( m 1 ) ] l [ ( i 1 ) % ( m 1 ) ] α
  2: l [ ( i 1 ) % ( m 1 ) ] ADD( K [ 0 ] , l [ ( i 1 ) % ( m 1 ) ] )
  3: l [ ( i 1 ) % ( m 1 ) ] X gate( ( i 1 ) , l [ ( i 1 ) % ( m 1 ) ] )
  4: K [ 0 ] K [ 0 ] β
  5: K [ 0 ] CNOT( l [ ( i 1 ) % ( m 1 ) ] , K [ 0 ] )
  6: R K [ i ] K [ 0 ] )
  7: return R K [ i ]

3.4.2. Round Function

Round function of SPECK from Equation (16) uses only input plaintext X and round key R K . It proceeds by updating the input X, and encryption is completed when all round functions are performed. The detailed process for this is described in Algorithm 13. The overall quantum circuit for SPECK-32/64 is shown in Figure 14.
Algorithm 13 Round function of SPECK.
Input:X, R K , Round i
Output: X i + 1
  1: X i [ 1 ] X i [ 1 ] α
  2: X i [ 1 ] ADD( X i [ 0 ] , X i [ 1 ] )
  3: X i + 1 [ 1 ] CNOT( R K i [ i ] , X i [ 1 ] )
  4: X i [ 0 ] X i [ 0 ] β
  5: X i + 1 [ 0 ] CNOT( X i + 1 [ 1 ] , X i [ 0 ] )
  6: return X i + 1 = { X i + 1 [ 0 ] , X i + 1 [ 1 ] }

4. Evaluation

In order to evaluate quantum gates, we utilized the quantum computer emulator. We utilized the well-known IBM’s ProjectQ framework for evaluation of the proposed method (https://github.com/ProjectQ-Framework/ProjectQ). The framework provides quantum computer compiler and quantum resource estimator. This is useful for accurate evaluation. Proposed quantum gates are written in Python and follow the ProjectQ grammar.

4.1. Cost of Quantum Gates

The most expensive of the quantum gates used in the implementation is the Toffoli gate. Toffoli gate consists of six CNOT gates + seven T gates. In other words, Toffoli gate costs more than six CNOT gates. Therefore, the number of Toffoli gates is the most important factor in evaluating quantum resources. On the other hand, the cost of an X gate is the cheapest and the number used for implementation is overall negligibly low.

4.2. Korean Block Ciphers in Quantum Gates

Korean block ciphers, such as CHAM, LEA, and HIGHT, are based on the ARX architecture. However, the primitive operations for each block cipher are totally different, in terms of word size and the number of operations. In Table 6, the quantum resource estimates for each block cipher, and the higher cost is shown in red and the lower cost is shown in green. The detailed comparison is as follows.

4.2.1. Case 1: 64-Bit Plaintext & 128-Bit Key

First, we compared CHAM-64/128 and HIGHT-64/128 block ciphers in terms of quantum resources. The number of qubit, Toffoli gate, and CNOT gate for CHAM-64/128 is lower than HIGHT-64/128 by 5, 3872, and 8203, respectively. In CHAM-64/128, it is all about performing a 16-bit Addition operation once in the round function. However, in HIGHT, 8-bit addition operations are performed 14 times in the round function, including the reverse operation. As a result, the circuit complexity of HIGHT is higher, even though CHAM performs more round functions. Only the number of X gates for HIGHT-64/128 is lower than CHAM-64/128 by 236. This is because CHAM performs an operation that XOR-ing constant i.

4.2.2. Case 2: 128-Bit Plaintext & 128-Bit Key

Second, we compared CHAM-128/128 and LEA-128/128 block ciphers in terms of quantum resources. The number of qubit, Toffoli gate, and CNOT gate for CHAM-128/128 is lower than LEA-128/128 by 117, 5456, and 1120, respectively. From the qubit point of view, LEA adds the constant δ to the key value in the key schedule. If it was an XOR operation, it can be solved only by an X gate without an additional qubit like CHAM. However, because it is an addition operation, setting the value of δ requires 128 qubits, so LEA uses more qubits. As you can see intuitively, the key schedule and round function of the LEA consist mostly of addition. Therefore, LEA has the high complexity among the block ciphers in this paper. Only the number of X gates for LEA-128/128 is lower than CHAM-128/128 by 172. This is because, unlike CHAM, LEA does not use the X gate during the round function, but uses the X gate only when initially setting the δ value. The number of X gates is equal to the δ ’s hamming weight.

4.2.3. Case 3: 128-Bit Plaintext & 256-Bit Key

Third, we compared CHAM-128/256 and LEA-128/256 block ciphers. The number of qubit, Toffoli gate, and CNOT gate for CHAM-128/256 is lower than LEA-128/256 by 245, 11,904, and 13,152, respectively. Only the number of X gate for LEA-128/256 is lower than CHAM-128/256 by 174. This result also shows that, even in large-scale parameters, CHAM has lower complexity in quantum gates than LEA.

4.2.4. CASE 4: Addition of LEA and HIGHT

Lastly, we compared addition of LEA and HIGHT. LEA-128 performs addition operations four times in the key schedule, three times in the round function, a total of seven, whereas HIGHT performs addition operations four times in the key schedule, four times in the round function, a total of eight. Unlike a classic computer, on a quantum computer, initializing qubits to its previous value requires a reverse operation that iterates over what was done. Since the result of the addition operation of the LEA gets used continuously, the reverse operation is not required. On the other hand, in HIGHT, in order to minimize the usage of the qubit, it is necessary to perform the reverse operation after using the addition result. Therefore, a total of six reverse operations are added, resulting in increased circuit complexity.
Overall, the CHAM block cipher requires the lowest quantum resources. This result introduces the fact that classical security level is not directly related to quantum attack efforts. The lesson is that modern lightweight block ciphers are not good options against quantum computers.

4.3. Software-Oriented and Hardware-Oriented Block Ciphers

We also evaluated the quantum resources for software-oriented block cipher (i.e., SPECK) and hardware-oriented block cipher (i.e., SIMON). SPECK consists of addition, XOR, and rotation, while SIMON consists of logical-and, XOR, and rotation. The main difference is addition (i.e., SPECK) and logical-and operation (i.e., SIMON). In Table 7, the comparison between SPECK and SIMON in terms of quantum resources is given. The result shows that the number of qubit, toffoli gate, and CNOT gate for SIMON is lower than SPECK. Only the number of X gate for SPECK is lower than SIMON. For this reason, we can conclude that hardware oriented block cipher is more vulnerable than software-oriented block cipher in terms of Grover search algorithm.

4.4. SPN and ARX Based Block Ciphers

AES is based on SPN structure composed of AddRoundkey, ShiftRows, SubBytes, and MixColumn.
AddRoundkey is an operation that XOR-ing a key value to data, and can be implemented relatively simple by using only CNOT gates. ShiftRows is free because it uses only rotation operations.
On the other hand, MixColumn requires a (complicated) multiplication circuit, which uses more Toffoli gate than addition circuit, and generic n-bit multiplication requires at least an additional n qubits. Some multiplication works using the Karatsuba algorithm have been performed, which can reduce the number of Toffoli gates, but this requires extra qubits. SubBytes is an operation for substituting data in 8-bit units, and the actual operation is an operation for affine conversion after obtaining an inverse on G F ( 2 8 ) for one byte. For inversion operation, squaring and multiplication are performed together. Squaring can be performed with only 19 CNOT gates on an 8-bit basis without additional qubits, but, as mentioned earlier, inversion is a complex circuit because of multiplication. That is, in the SPN structure, the complexity of the circuit is greatly increased compared to the ARX structure due to SubBytes of substitution and MixCoulmn of permutation.
Several studies with quantum resource estimation required for AES block ciphers are presented in Table 8. The implementation of Langenberg et al. [7] is relatively well optimized because the S-box operation is optimized efficiently.

5. Conclusions

In this paper, we presented the optimized implementation of ARX-based Korean block ciphers in quantum gates. The proposed implementation achieved the optimal number of qubit and quantum gates by carefully designing the adder circuit and its reversible gates. This is the first implementation of Korean block ciphers in quantum gates. The result shows that the CHAM block cipher requires the lowest quantum resources, which means the CHAM block cipher is the most vulnerable towards the Grover search algorithm. We also evaluated the SPECK and SIMON on quantum gates. The result shows that hardware-oriented block cipher (i.e., SIMON) shows the lower quantum resources than SPECK.

Author Contributions

Investigation, H.K. (Hyeokdong Kwon), H.K. (Hyunji Park) and J.P.; Software, K.J. and H.S.; Supervision, H.S.; Writing—original draft, K.J.; Writing—review and editing, S.C. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by Institute for Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government(MSIT) (<Q|Crypton>, No. 2019-0-00033, Study on Quantum Security Evaluation of Cryptography based on Computational Quantum Complexity).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Atzori, L.; Iera, A.; Morabito, G. The Internet of Things: A survey. Comput. Netw. 2010, 54, 2787–2805. [Google Scholar] [CrossRef]
  2. Biryukov, A.; Perrin, L.P. State of the Art in Lightweight Symmetric Cryptography; Technical Report 2017/511, Cryptology ePrint Archive; University of Luxembourg: Luxembourg, 2017. [Google Scholar]
  3. Hankerson, D.; Menezes, A.J.; Vanstone, S. Guide to Elliptic Curve Cryptography; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2006. [Google Scholar]
  4. Shor, P.W. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings of the 35th IEEE Annual Symposium on Foundations of Computer Science, Santa Fe, NM, USA, 20–22 November 1994; pp. 124–134. [Google Scholar]
  5. Grover, L.K. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996; pp. 212–219. [Google Scholar]
  6. Grassl, M.; Langenberg, B.; Roetteler, M.; Steinwandt, R. Applying Grover’s algorithm to AES: Quantum resource estimates. In Post-Quantum Cryptography; Springer: Berlin/Heidelberg, Germany, 2016; pp. 29–43. [Google Scholar]
  7. Langenberg, B.; Pham, H.; Steinwandt, R. Reducing the Cost of Implementing AES as a Quantum Circuit; Technical Report 2019/854, Cryptology ePrint Archive; University of Luxembourg: Luxembourg, 2019. [Google Scholar]
  8. Jaques, S.; Naehrig, M.; Roetteler, M.; Virdia, F. Implementing Grover oracles for quantum key search on AES and LowMC. In Proceedings of the Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zagreb, Croatia, 10–14 May 2020; Springer: Berlin/Heidelberg, Germany, 2020; pp. 280–310. [Google Scholar]
  9. Anand, R.; Maitra, A.; Mukhopadhyay, S. Grover on SIMON. arXiv 2020, arXiv:2004.10686. [Google Scholar] [CrossRef]
  10. Beaulieu, R.; Shors, D.; Smith, J.; Treatman-Clark, S.; Weeks, B.; Wingers, L. The SIMON and SPECK Families of Lightweight Block Ciphers. IACR Cryptol. ePrint Arch. 2013, 2013, 404–449. [Google Scholar]
  11. Hong, D.; Sung, J.; Hong, S.; Lim, J.; Lee, S.; Koo, B.S.; Lee, C.; Chang, D.; Lee, J.; Jeong, K.; et al. HIGHT: A new block cipher suitable for low-resource device. In Proceedings of the International Workshop on Cryptographic Hardware and Embedded Systems, Yokohama, Japan, 10–13 October 2006; Springer: Berlin/Heidelberg, Germany, 2006; pp. 46–59. [Google Scholar]
  12. Koo, B.; Roh, D.; Kim, H.; Jung, Y.; Lee, D.G.; Kwon, D. CHAM: A Family of Lightweight Block Ciphers for Resource-Constrained Devices. In Proceedings of the International Conference on Information Security and Cryptology (ICISC’17), Seoul, Korea, 29 November–1 December 2017; Springer: Cham, Switzerland, 2017. [Google Scholar]
  13. Roh, D.; Koo, B.; Jung, Y.; Jeong, I.W.; Lee, D.G.; Kwon, D.; Kim, W.H. Revised Version of Block Cipher CHAM. In Proceedings of the International Conference on Information Security and Cryptology, Seoul, Korea, 4–6 December 2019; Springer: Cham, Switzerland, 2019; pp. 1–19. [Google Scholar]
  14. Hong, D.; Lee, J.K.; Kim, D.C.; Kwon, D.; Ryu, K.H.; Lee, D.G. LEA: A 128-bit block cipher for fast encryption on common processors. In Proceedings of the International Workshop on Information Security Applications, Jeju Island, Korea, 19–21 August 2013; Springer: Cham, Switzerland, 2013; pp. 3–27. [Google Scholar]
  15. Cuccaro, S.A.; Draper, T.G.; Kutin, S.A.; Moulton, D.P. A new quantum ripple-carry addition circuit. arXiv 2004, arXiv:quant-ph/0410184. [Google Scholar]
  16. Draper, T.G. Addition on a quantum computer. arXiv 2000, arXiv:quant-ph/0008033. [Google Scholar]
  17. Draper, T.G.; Kutin, S.A.; Rains, E.M.; Svore, K.M. A logarithmic-depth quantum carry-lookahead adder. arXiv 2004, arXiv:quant-ph/0406142. [Google Scholar]
  18. Vedral, V.; Barenco, A.; Ekert, A. Quantum networks for elementary arithmetic operations. Phys. Rev. A 1996, 54, 147. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  19. Daemen, J.; Rijmen, V. AES Proposal: Rijndael; NIST AES Competition; Springer: Berlin/Heidelberg, Germany, 1999; pp. 1–45. [Google Scholar]
  20. Langenberg, B.; Pham, H.; Steinwandt, R. Reducing the Cost of Implementing the Advanced Encryption Standard as a Quantum Circuit. IEEE Trans. Quantum Eng. 2020, 1, 1–12. [Google Scholar]
  21. Almazrooie, M.; Samsudin, A.; Abdullah, R.; Mutter, K.N. Quantum reversible circuit of AES-128. Quantum Inf. Process. 2018, 17, 112–177. [Google Scholar] [CrossRef]
Figure 1. Key schedule and round function of HIGHT.
Figure 1. Key schedule and round function of HIGHT.
Applsci 10 06407 g001
Figure 2. Key schedule of CHAM.
Figure 2. Key schedule of CHAM.
Applsci 10 06407 g002
Figure 3. Round function of CHAM.
Figure 3. Round function of CHAM.
Applsci 10 06407 g003
Figure 4. Key schedule of LEA-128.
Figure 4. Key schedule of LEA-128.
Applsci 10 06407 g004
Figure 5. i-th round function of LEA.
Figure 5. i-th round function of LEA.
Applsci 10 06407 g005
Figure 6. Overview of SPECK( m = 2 ) block cipher: key schedule and encryption.
Figure 6. Overview of SPECK( m = 2 ) block cipher: key schedule and encryption.
Applsci 10 06407 g006
Figure 7. Circuit configuration of the (left) CNOT and (right) Toffoli gate.
Figure 7. Circuit configuration of the (left) CNOT and (right) Toffoli gate.
Applsci 10 06407 g007
Figure 8. Grover search algorithm.
Figure 8. Grover search algorithm.
Applsci 10 06407 g008
Figure 9. Condition after the oracle of Grover algorithm.
Figure 9. Condition after the oracle of Grover algorithm.
Applsci 10 06407 g009
Figure 10. Condition after diffusion of the Grover algorithm.
Figure 10. Condition after diffusion of the Grover algorithm.
Applsci 10 06407 g010
Figure 11. Quantum circuit for HIGHT.
Figure 11. Quantum circuit for HIGHT.
Applsci 10 06407 g011
Figure 12. Quantum circuit for CHAM-64/128.
Figure 12. Quantum circuit for CHAM-64/128.
Applsci 10 06407 g012
Figure 13. Quantum circuit for LEA-128.
Figure 13. Quantum circuit for LEA-128.
Applsci 10 06407 g013
Figure 14. Quantum circuit for SPECK-32/64.
Figure 14. Quantum circuit for SPECK-32/64.
Applsci 10 06407 g014
Table 1. Notations.
Table 1. Notations.
NotationMeaning
KInitial keywords
R K Round key
XOR operation
Modular addition operation
ROL i Rotation left operation (i-bit)
ROR i Rotation right operation (i-bit)
Table 2. Parameters of HIGHT.
Table 2. Parameters of HIGHT.
CipherBlock Size (Bits)Key Size (Bits)Word Size (Bits)KeywordsRounds
HIGHT6412881632
Table 3. Parameters of CHAM.
Table 3. Parameters of CHAM.
CipherBlock Size (bits)Key Size (bits)Word Size (Bbits)KeywordsRounds
CHAM-64/1286412816880
CHAM-128/12812812832480
CHAM-128/25612825632896
Table 4. Parameters of LEA.
Table 4. Parameters of LEA.
CipherBlock Size (bits)Key Size (bits)Word Size (bits)KeywordsRounds
LEA-12812812832424
LEA-19212819232628
LEA-25612825632832
Table 5. Parameters of SPECK.
Table 5. Parameters of SPECK.
Block Size (bits)Key Size (bits)Word Size (bits)KeywordsRounds
326416422
4872, 96243, 422, 23
6496, 128323, 426, 27
9696, 144482, 328, 29
128128, 192, 256642, 3, 432, 33, 34
Table 6. Comparison between Korean block ciphers in terms of quantum resources.
Table 6. Comparison between Korean block ciphers in terms of quantum resources.
Block CipherPlaintext (bit)Key (bit)Qubits UsedToffoli GatesCNOT GatesX Gates
CHAM64128196240012,285240
128128268496026,885240
128256396595232,277304
HIGHT64128201627220,5234
LEA12812838510,41628,08068
12819251315,62439,816100
12825664117,85645,504130
Table 7. Comparison between SPECK and SIMON in terms of quantum resources.
Table 7. Comparison between SPECK and SIMON in terms of quantum resources.
Plaintext (bit)Key (bit)Qubits UsedToffoli GatesCNOT GatesX Gates
SPECKSIMON [9]SPECKSIMON [9]SPECKSIMON [9]SPECKSIMON [9]
3264979612905123706281642448
487212112019828645606331242792
489614514420748645866480045768
64961611603162134488905184541248
641281931923286140892387396571216
96961931925172249614,4369792602400
961442412405360259214,96010,080642448
1281282572567942435222,08617,152754224
1281923213208192441622,78417,472804224
1282563853848444460823,48426,624814352
Table 8. Quantum resources to implement AES-128.
Table 8. Quantum resources to implement AES-128.
Block CipherQubits UsedToffoli GatesCNOT GatesX Gates
Grassl et al. [6]984151,552166,5481456
Almazrooie et al. [21]976150,528192,8321370
Langenberg et al. [20]86416,940107,9601507

Share and Cite

MDPI and ACS Style

Jang, K.; Choi, S.; Kwon, H.; Kim, H.; Park, J.; Seo, H. Grover on Korean Block Ciphers. Appl. Sci. 2020, 10, 6407. https://doi.org/10.3390/app10186407

AMA Style

Jang K, Choi S, Kwon H, Kim H, Park J, Seo H. Grover on Korean Block Ciphers. Applied Sciences. 2020; 10(18):6407. https://doi.org/10.3390/app10186407

Chicago/Turabian Style

Jang, Kyoungbae, Seungju Choi, Hyeokdong Kwon, Hyunji Kim, Jaehoon Park, and Hwajeong Seo. 2020. "Grover on Korean Block Ciphers" Applied Sciences 10, no. 18: 6407. https://doi.org/10.3390/app10186407

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop