# An Improved Multi-Chaotic Public Key Algorithm Based on Chebyshev Polynomials
## 4 Software Implementation
### An Example  
PYTHON is a popular and powerful programming language that can be used for mathematical calculation and analysis. In our software implementation, we used algorithm libraries under the Windows environment. Below, we provide a specific example to verify the effectiveness of the proposed algorithm. Step 1. [PERSON] and [PERSON] publicly negotiate and determine the initial values \(x_{0}=112,233\) and \(N=167,413,457\). They select two functions \(f_{k_{n}}(x),f_{k_{\beta}}(x)\) in Equation (25), where the selection rule for \(k_{i}\) is as described in Section 4.1.3. \[h(x,\ k)=\left\{ \begin{array}{ll}f_{1}(112,233)(mod\ 167,413,475)&if\ k=1,\\ f_{2}(112,233)(mod\ 167,413,475)&if\ k=2,\\ \vdots&\\ f_{\widetilde{m}}(112,233)(mod\ 167,413,475)&if\ k=\widetilde{m}.\end{array} \right., \tag{25}\]  
where \(f_{1}(x_{0}),f_{2}(x_{0}),\cdots,f_{\widetilde{m}}(x_{0})\) are Chebyshev polynomials and are calculated using the fast algorithm described in Section 4.1.1. Step 2. [PERSON] randomly selects a key seed \(s_{A}=0.123456\) and a large number \(n_{A}=1000\in[0,\ N]\). She inputs these parameters into a pseudo-random sequence generator (as described in Section 4.1.2) and obtains a sequence \(r_{A}\) of length \(n_{A}=1000\). The output of this example is as follows:  
\[r_{A}=[01011110101011\cdots 101111].\]  
According to Table 2, we select \(k_{n}=k_{5}=16,k_{\beta}=k_{3}=10\) and the functions \(f_{k_{n}}=f_{16}\) and \(f_{k_{\beta}}=f_{10}\) based on \(k_{n}\) and \(k_{\beta}\). Then, calculate the number of \(0\)s and \(1\)s in the sequence \(r_{A}\), denoted as \(n_{A1}=267\) and \(n_{A2}=733\), respectively. Next, we compute \(f_{k_{n}}(x_{0})(modN)=f_{16}(112,233)(mod\ 167,413,475)=21,588,224\) and \(f_{k_{\beta}}(x_{0})(modN)=f_{10}(112,233)(mod\ 167,413,475)=53,130,926\) and iterate these calculations, respectively, \(n_{A1}=267\) and \(n_{A2}=733\) times to obtain \(x_{nA}=f_{k_{n}}^{n_{A1}}f_{k_{\beta}}^{n_{A2}}(x_{0})=f_{16}^{267}f_{10}^{733} (112,233)=123,490,595\). Finally, \(x_{nA}\) is transmitted as the public key to [PERSON]. Step 3. Similarly, [PERSON] randomly selects a key seed \(s_{B}=0.56789\) and a large number \(n_{B}=1200\in[0,\ N]\), and inputs these parameters into a pseudo-random sequence generator (as in Section 4.1.2). This generates a sequence of length \(n_{B}=1200\) consisting of \(\{0,1\}\), denoted as \(r_{B}\), and the results are as follows:  
\[r_{B}=[10110101111011\cdots 011111].\] \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Group** & \(\boldsymbol{r}\) & \(\boldsymbol{d}\) & \(\boldsymbol{k}_{i}\) \\ \hline
1 & 13,297 & 19,973 & \(k_{5}=16\) \\
2 & 25,127 & 26,777 & \(k_{3}=10\) \\
3 & 46,261 & 47,059 & \(k_{3}=10\) \\
4 & 8761 & 8353 & \(k_{4}=13\) \\
5 & 3319 & 8369 & \(k_{1}=4\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Values of coefficient \(k_{i}\) under arbitrary transformations of \(r\) and \(s\). According to Section 4.1.3, [PERSON] calculates \(k_{n}=k_{5}=16,k_{\beta}=k_{3}=10\) based on [PERSON]'s public key. Similarly, [PERSON] selects the functions \(f_{k_{n}}=f_{16}\) and \(f_{k_{\beta}}=f_{10}\) based on \(k_{n}\) and \(k_{\beta}\). [PERSON] counts the number of 0s and 1s in \(r_{B}\), which are \(n_{B1}=340\) and \(n_{B2}=860\), respectively. By applying the functions \(f_{k_{n}}(x_{0})(modN)=21,588,224\) and \(f_{k_{\beta}}(x_{0})(modN)=53,130,926\), [PERSON] iterates these calculations \(n_{B1}=340\) and \(n_{B2}=860\) times. This results in \(x_{nB}=f_{k_{n}}^{\mathsf{min}}f_{k_{\beta}}^{\mathsf{min}}(x_{0})=f_{16}^{340 }f_{10}^{860}(112,233)=16,931,337\), with \(x_{nB}\) then transmitted as the public key to [PERSON]. Step 4. [PERSON] iterates \(x_{nB}\) over \(n_{A}\) times based on \(r_{A}\) to obtain \(x_{nB+nA}\). According to Equation (14), we have:  
\[x_{nB+nA}=f_{k_{n}}^{n_{A}}f_{k_{\beta}}^{n_{A2}}(x_{nB})=f_{16}^{267}f_{10}^{ 733}(16,931,337)=63,457,287.\]  
Step 5. Similarly, [PERSON] iterates \(x_{nA}\) over \(n_{B}\) times based on \(r_{B}\) to obtain \(x_{nA+nB}\).