# Underlying Security Transmission Design for Orthogonal Time Frequency Space (OTFS) Modulation
## 4 Secret Key Generation Algorithm
### Gost Method-Based Secret Key Generation  
As shown in Figure 4, the GOST-based key generation algorithm contains two parts: round function and compression-expansion.  
The detailed Gost algorithm is detailed in Algorithm 1. Since our algorithm uses 64-bit grouping on the input data, we must first change the input data to a multiple of 64. That is, if the length of the data to be encrypted is less than 64 bits, it must be padded to 64 bits; if the length of the data to be encrypted exceeds 64 bits, it must first be padded to a multiple of 64. Then, the data that need to be encrypted are divided into two parts, each containing 32 bits. Because the round function is iterated for 64 rounds, we use a 2048-bit key and perform the addition of the (mod232) operation with the right part of the data to obtain the new right part, denoted by itmp. Then, the itmp passes through the S box. That is, the 32-bit itmp is equally divided into eight blocks; each block has four bits, and the value of each block does not exceed \(Oxf\). The S box of the secret key generation algorithm has a total of eight groups that correspond to these eight blocks one-to-one. For example, if the value of the third block is eight, then replace the original value of the third block with the value at the eighth column of the third group of the S box. Repeat the above steps eight times to obtain a new itmp. Subsequently, the new itmp and the left part perform the \(XOR\)  
Figure 3: Flowchart of SLM.  
operation to obtain the right part of the next round. Additionally, the left part of the next round is obtained from the right part of the previous round, as follows:  
\[R_{j+4}^{i+1}=Sboxj\Big{(}R_{j+4}^{i+1}\otimes K_{i}\Big{)}\oplus R_{j}^{i}, \tag{17}\]  
\[R_{j}^{i+1}=R_{j+4}^{i}, \tag{18}\]  
where \(i=1,2,\cdots,64\) represents the i-th iteration, \(j=1,2,3,4\) represents the j-th S box, '\(\otimes\)' and '\(\oplus\)', respectively, represent the addition of (mod23) and the binary operation of XOR. At this point, one round of non-linear transformation is complete. Repeat the above steps. The output ciphertext composed of eight parts can be obtained after 64 iterations. Then, by applying the rotate left operator, the final ciphertext can be obtained, as shown in Equation (19).  
\[\begin{split} C&=\Big{(}\Big{(}R_{1}^{64}\oplus R_{2 }^{64}\Big{)}\oplus\Big{(}R_{3}^{64}\oplus R_{4}^{64}\Big{)}\Big{)}\\ &\oplus\Big{(}\Big{(}R_{5}^{64}\oplus R_{6}^{64}\Big{)}\oplus \Big{(}R_{7}^{64}\oplus R_{8}^{64}\Big{)}\Big{)}.\end{split} \tag{19}\]  
In this article, since we use the detected channel state information as the input of this secret key generation algorithm, we can obtain multiple corresponding output ciphertexts. Using \(N=128\) as an example, in order to control the permutation of the IFFT matrix of the ISFFT transformation, we obtain 128 ciphertext outputs. Sort the output ciphertext in ascending order and then obtain the index sequence (\(D_{z}\), \(D_{w}\)) that con  
Figure 4: Flowchart for the GOST method-based secret key generation.  
trols the row permutation and column permutation, respectively, as shown in Figure 5.