# A Novel Hybrid Elementary Cellular Automata and Its Application in a Stream Cipher
## 4 Stream Cipher Based on HECA-M
### Description of Proposed Stream Cipher
The buffer serves two purposes: intercept initial iterations and select sequences from the original keystream to form the final keystream. The number of initial iterations is determined by 10 bits in the middle of the \(\mathbf{inv}\) in Equation (5) and represented as follows:

\[n_{0}=\text{bin2}dec(\mathbf{inv}(252:261))+500, \tag{6}\]

where \(n_{0}\) denotes the initial iterations. The beginning of the sequences with length \(n_{0}\) will be removed in the original keystream. The function \(\text{bin2 dec}(\bullet)\) is to transform a binary number into a decimal. The purpose of the above process is to effectively hide the initial value of the HECA-M and practical iterations. The output of the buffer is determined by the Hamming weight of \(\mathbf{inv}\), which is described as the following:

\[flag=\text{Hamming}(\mathbf{inv})\bmod 2, \tag{7}\]

where _flag_ is utilized to control the output of the buffer. The output of cells with even (odd) indexes is regarded as the final keystream if the flag is zero (one). For instance, if the flag is zero, the final keystream is generated by the cells 2 nd, 4 th,..., 256 th. ### Statistic and Secure Analyses

1. NIST test

The randomness of the keystream is an important statistic property for a stream cipher. Without the loss of generality, the test suite SP800-22 of the National Institute of Standards and Technology (NIST) [35] is employed to prove the randomness of the sequences generated by the HECA-M under all chaotic rule groups in the LUT (Table 5). There are 15 sub-tests in this test suite, and the \(p\)-value of each test estimates the randomness of the sequence. In this paper, the significance level \(\alpha\) is set to 0.01. If \(p\)-value \(\geq\alpha\), the sequence appears to be random, which means that the sequence would be considered to be random with a confidence of 99%. We assign the number of iterations as \(1\times 10^{6}\), and the length of each HECA-M is 256. A total of 27 HECA-Ms under different chaotic rule groups are iterated to generate sequences. Furthermore, 128 binary sequences with \(1\times 10^{6}\) bits generated by each HECA-M's odd cells are selected to be tested. According to Ref. [35], the minimum pass rate for each statistical test with the exception of the random excursion (variant) test is approximately 123 for a sample with 128 binary sequences. The test results of 27 HECA-Ms with different chaotic rule groups are listed in Table 6.

Notes: No. indicates the index of the chaotic rule group in the LUT (Table 5). The number in the first row represents the index of the sub-test in the test suite SP800-22. * denotes that there are multiple tests in this sub-test. *Pass\" means that the sequences can pass all of these multiple tests. \begin{table}
\begin{tabular}{c c c c c c c c c c c c c c c} \hline \hline \multirow{2}{*}{_No._} & \multirow{2}{*}{**1**} & \multirow{2}{*}{**2**} & \multirow{2}{*}{**3**} & \multirow{2}{*}{**4**} & \multicolumn{4}{c}{**The Index of the Sub-Test in the Test Suite SP800-22**} & & & \\  & & & & & & & & & & & & & & & \\



Frequency & & & & & & & & & & & & & & & & \\
4. Runs & & & & & & & & & & & & & & & & \\
7. FFT & & & & & & & & & & & & & & & \\
10. Universal & & & & & & & & & & & & & & & & \\
13. Random excursions variant * & & & & & & & & & & & & & & & \\ \hline \hline \end{tabular} Notes: No. indicates the index of the chaotic rule group in the LUT (Table 5). The number in the first row represents the index of the sub-test in the test suite SP800-22. * denotes that there are multiple tests in this sub-test. *Pass” means that the sequences can pass all of these multiple tests.

\end{table} 
Table 6: Results of the NIST test for HECA-Ms with different chaotic rule groups. There is no doubt that the randomness of all sequences generated by the HECA-M under 27 different chaotic rule groups can pass the NIST test, according to Table 6. Additionally, it means the keystream generated by the proposed scheme with any chaotic rule group in the LUT (Table 5) can meet the randomness requirement.