Strengthening Quality of Chaotic Bit Sequences

: We discuss chaos and its quality as measured through the 0-1 test for chaos. When the 0-1 test indicates deteriorating quality of chaos, because of the ﬁnite precision representations of real numbers in digital implementations, then the process may eventually lead to a periodic sequence. A simple method for improving the quality of a chaotic signal is to mix the signal with another signal by using the XOR operation. In this paper, such mixing of weak chaotic signals is considered, yielding new signals with improved quality (with K values from the 0-1 test close to 1). In some sense, such a mixing of signals could be considered as a two-layer prevention strategy to maintain chaos. That fact may be important in those applications when the hardware resources are limited. The 0-1 test is used to show the improved chaotic behavior in the case when a continuous signal (for example, from the Chua, Rössler or Lorenz system) intermingles with a discrete signal (for example, from the logistic, Tinkerbell or Henon map). The analysis is presented for chaotic bit sequences. Our approach can further lead to hardware applications, and possibly, to improvements in the design of chaotic bit generators. Several illustrative examples are included.


Introduction
Most well-known chaotic-based bit generators use a single source (input), either a continuous or a discrete one [1,2]. Due to a possible synchronization [3][4][5][6] or prediction of a bit sequence because of a finite length representation [7][8][9], such sequences of bits could be compromised. Those problems are based on the fact that, in the finite precision arithmetic, the output of a single input discrete generator becomes periodic, and therefore nonchaotic, even if the length of the output sequence is of order 10 6 . For sequences with lengths greater than 10 6 , one can use the National Institute of Standards and Technology (NIST) tests to check certain statistical properties (i.e., randomness) of the sequences of bits. In this paper, we examine much shorter sequences (as short as 5000 bits), and we are interested in improving the levels of chaotic behavior of such sequences. The 0-1 test for chaos is the measurement tool applied to justify the improved quality of chaos.
In the quest to provide strong sequences of chaotic bits, we examine how two signals of mixed nature (continuous and discrete) behave when XORed. We claim that the quality of chaos is improved when various combinations of such signals are analyzed, as it is much more difficult to predict the chaotic binary output of the resulting signal. The parameters of the two (continuous and discrete) chaotic input systems can easily be modified each time the XORed process is run. It is shown that in the case of a small number of bits being represented, the proposed method works much better when compared with the single-source chaotic bit generators. Our method prevents periodicity, and the obtained sequence is truly chaotic, as evidenced by the results of the 0-1 test. Furthermore, the proposed XORing process with two segments, the discrete (logistic, Henon, Tinkerbell or other map) and analog (Chua, Rössler, Lorenz or another system), can be modeled and analyzed using the hardware description language VHDL-AMS, which is an industry standard modeling language for mixed signal circuits [10,11]. In this paper, however, we focus on analyzing the dynamical properties and features of the proposed output signal rather than hardware implementations. The method described in this paper is novel, and the XOR mixing of signals, while simple in nature, gives very good results, as shown by our illustrative examples, whose results were confirmed by the 0-1 test for chaos and the ent tests. A deterioration of the quality of chaotic signals, for example, due to a failure in the chaotic system's components or a Trojan insertion into the system, can be avoided by applying the method presented in this paper. Figure 1 shows the structure of the proposed process of mixing two signals. The continuous signal comes from any of the chaotic circuits of Chua, Rössler and Lorenz (or another), and the discrete signal can be any of the logistic, Henon, Tinkerbell and Baker maps (or another). As an example, Figure 2 shows the logistic map realization in a finite precision number representation for the equation

Continuous Chaotic System
Threshold Unit

Clock Source
Discrete Chaotic Map Synchronizer

The XOR Mixing Process
The continuous input in Figure 1 is discretized and synchronized with the internal clock of the discrete chaotic map. The two binary signals {D i } and {C j } are mixed through the XOR operation. As a result, a sequence of bits {N k } is obtained. The 0-1 test is then applied to the sequence {N k } to check its chaotic nature. If the result of the test is satisfactory (see the analysis below), the {N k } sequence is used to form a new sequence of chaotic bits. Otherwise, changes to the parameters of the discrete chaotic map should be considered to yield a better test result. One can also consider a replacement of the discrete chaotic system-for example, replacing the logistic map with a Tinkerbell, Henon, Baker or other discrete map [12].
The choice of XORing for mixing two signals is due to two main reasons. First, the operation is relatively simple, does not require complicated circuit realization and is widely used to mix transmitted data with secret keys in typical secure electronic transmission implementations. Furthermore, as demonstrated in this paper, the XOR operation significantly improves the quality of the obtained chaotic sequence-see the sections below. The mixing process gives a very good result, even with a small amount of bit representation. An important factor is that the quality analysis of the resulting sequence is done through a simple but reliable tool, namely, the 0-1 test, which can be implemented in a real time monitoring system.

Generation of Chaotic Bits
The chaotic behavior of the logistic map occurs for a certain range of the parameter µ. If the parameter value is chosen from that range, then for a chosen initial condition 0 < x(0) < 1, we obtain a sequence of real numbers in the interval (0, 1). Each of those real numbers is represented as a fixed point number. Those numbers are implemented in the digital structure of the logistic map shown in Figure 2. The [S|X 0j |X 1j |...| · |Y 0j |Y 1j |Y 2j |Y 3j |...] is a fixed point number representation. The j index is the iteration number of the logistic map (or another implemented discrete map). The S denotes the sign bit. The sign is the same in all iterations of the logistic map, because x(n) ∈ (0, 1) for all n = 0, 1, 2, . . . , but it may change from iteration to iteration when other discrete maps are used. The X ij are the integer part bits and the Y ij are the fractional part bits in the jth iteration. The output chaotic bits {D i } in Figure 2 are obtained in each iteration by using a bit at a selected position (fixed in all iterations) in the sequence of consecutive fixed point numbers.
Chaotic bits from the continuous system in Figure 1 result from a threshold unit, for example, in the form of a simple comparator [2]. A synchronization unit is used to synchronize those bits with the occurrence of bits {D i }. The discrete map is iterated to obtain x(n + 1) when a bit from the continuous chaotic system is received. The two independent chaotic sequences {D i } and {C j } in Figure 1 are mixed by the XOR operation. As a result, a new sequence of bits {N k } is obtained. This sequence is next tested by the 0-1 test for chaos [13][14][15][16][17][18].

Computational Results
We used sequences of 5000 numbers in all our numerical calculations, and 10,000 numbers in one visual experiment associated with the last figure in this paper. In addition, n cut = 10 and N c = 100 (see the description of the 0-1 test in Appendix A). Such values are suggested, for example, in [15].
First, we used the above approach to analyze the logistic map only, without a continuous chaotic system. For µ = 3.50, the following two cases were considered. First, we examined a sequence of real numbers from the logistic map. The q − p plot is shown in Figure 3a. Then, in the second case, the sequence of real numbers from the previous case was transformed to a respective fixed point representation. We selected a particular bit position and tested a sequence of bits from the consecutive fixed-point numbers; i.e., from each fixed-point number we selected a single bit of Y 0j in Figure 2 (on the 7th position) and formed a sequence of bits taken from that selected position. Choosing the 7th position has no particular significance, and any other position could also be used. However, using a single bit position may have a significant impact and be an efficient implementation method when hardware resources are limited, for example, in FPGA devices. In this paper, the logistic map is used in a fixed point representation. Figure 3b shows the q − p plot obtained in the second case. Since for µ = 3.50 the logistic map gives a nonchaotic signal, in both cases, the obtained q − p graphs are of regular shape, as shown in Figure 3a,b. An interesting result of our analysis is the fact that the nonchaotic nature of the sequence of real numbers (the first case above) is transformed into a nonchaotic nature of the sequence of bits {D i } (obtained from a selected single bit position as described in the second case above). The K values from the 0-1 test in the two cases above are 0.0015 and 0.0025, respectively. These numbers clearly indicate a periodic nature of the analyzed sequences.
The same two cases were analyzed for the logistic map with µ = 3.99, which resulted in chaotic behavior. The corresponding q − p plots are shown in Figure 3c    The Chua (or another analog chaotic generator) can be realized as a hardware device (with elements R, C and diodes together with op-amps) or as a software implementation of the discretization of a solution of a system of differential equations [19]. Figure 5a shows the results of applying the 0-1 test when a sequence of 7th bits was used for generated numbers with various lengths of sequence Y (between 8 and 32). Logistic map with µ = 3.99 was used. It is clear from Figure 5a that the chaotic sequences (the K values close to 1) are obtained for numbers of 22 or more bits. All numbers of 16 and fewer bits indicate regular (nonchaotic) sequences formed of the 7th bits. If the sequences of 7th bits (from logistic map) are XORed with the bits resulting from the continuous chaotic Chua (Matsumoto) circuit [19], then all the new sequences show chaotic nature with K values close to 1, as shown in Figure 5b. Moreover, we also fixed the length of numbers obtained from the logistic map (with µ = 3.99) to 18 bits, and as shown in Figure 5a, we obtained K = 0.2079 for the sequence of 7th bits. The corresponding q − p plot is shown in Figure 6a. The q − p plot is fairly regular (as expected for K = 0.2079), and the sequence of 7th bits can, at best, be classified as weakly chaotic. The same sequence, when XORed with a sequence obtained from continuous Chua (Matsumoto) circuit, gives K = 0.9874, and the q − p plot is irregular, as shown in Figure 6b. Figure 7a shows a result similar to that of Figure 6a, but it illustrates another interesting fact about the 0-1 test. Notice that for a sequence with a 21 bit representation, we obtained K = 0.6038, which is almost in the middle between 0 and 1. The q − p plot for this case is shown in Figure 7b. The case can be classified as weak chaos with a fairly regular plot of q − p.
We also examined a mixing process of chaotic bit sequences with various values of µ (3.11 ≤ µ ≤ 3.99) and XOR operations with other continuous chaotic systems, such as the Chua system with Kennedy diode, Rössler and Lorenz chaotic continuous systems. The K values obtained in all such cases were all greater than 0.99, with differences in the third and fourth decimal digits. Figures 8 and 9 show the bit sequences {D i }, {C j } and {N k } for the Chua (Matsumoto) system with a logistic map (µ = 3.99, Figure 8) and the Lorenz system with a logistic map (µ = 3.99, Figure 9). The {N k } sequences yielded K = 0.9981 and K = 0.9983 in Figure 8 and Figure 9, respectively. Figure 10 shows the result of using a logistic map for µ = 3.99 and 12-bit precision of {Y 0j }. The value of µ = 3.99 should indicate chaotic dynamics. However, due to the small number of bits used, we obtained a non-chaotic (or regular)  Figure 10 are characterized by values of K of 0.0011, 0.9980 and 0.9950, respectively. Thus, Figure 10 illustrates the case when one of the two input sources are regular (non-chaotic sequence {D i }), and yet, thanks to the XOR operation with another source sequence (with a relatively small number of precision bits), we obtain a strong chaotic sequence {N k }. Thus, the analog part of the mixing process (Chua circuit) assures us that the overall performance is firmly chaotic (K = 0.9950), despite the fact that a regular sequence (K = 0.0011) is obtained from the discrete part (logistic map) of the process. Each of the three figures, Figures 8-10, shows the first 100 bits in the respective sequences of 5000 bits in length.

The Nine Sequences and Their Visual Quality
Various chaotic bit sequences were created either from a single-source (generator) or by using the XOR operation. We list these sequences in Table 1 and mark them as the sequences s1, s2, . . . , s9. As a reference sequence, s1, we selected a sequence obtained from a commercially available quantum generator QUANTIS manufactured by the Swiss firm ID Quantique as a source of the high-entropy signals [20]. We used the model USB-4M with the serial number 163109A410. Sequence s1, as the one with excellent quality parameters, is a reference sequence to which we relate all other chaotic sequences obtained with the XOR operation.  Figure 2) s5 chaotic bits from logistic eqn. (10 bits {Y 0j }, see Figure 2) sequence s3 XOR sequence s5 Figure 11 shows examples of the scatter plots of s1-s9, each consisting of 10,000 bits stacked in rows of 100 bits. A visual and rather subjective observation of the nine sequences in Figure 11 indicates that the scatter plots of sequences s6 (s2 XOR s4) and s7 (s3 XOR s4) are very close to that of the ideal sequence s1. The scatter plot obtained from the logistic equation with 32 bit representation (sequence s4) also seems to be of good quality, but the same logistic equation yielded a much worse scatter plot if only 10 bits were used (sequence s5). The scatter plots of sequences s2 and s3 seem to be of low quality when compared to the scatter plot of s1. Sequences s2 and s3 and their scatter plots depend heavily on the threshold value of the threshold unit in Figure 1 and on the method of registering of chaotic bits and the frequency of the internal clock. Those parameters should be adjusted experimentally for various chaotic systems. The scatter plot of s9 (s3 XOR s5) confirms, at least visually, that the low quality sequence s5 was improved after the XOR operation.
The s4 sequence was generated by the system in Figure 2. There is a danger of having a repeated, identical sequences s4, if the system uses the same initial seed value. Furthermore, having a finite number of bits available to represent initial condition (seed value), there is a danger of inserting the same seed value after many repeated cycles of using a single input logistic map based output. Such a generator will output sequences that have already been generated before. This and other related issues are discussed in [22].

The ent Test Results
The above visual observations of the scatter plots in Figure 11 were, to a large extent, confirmed by the results of the six ent tests [23] (see Appendix B), which are analyzed below. We used the ent tests because of a relatively short lengths of the analyzed bit sequences s1-s9. The results shown in Table 2 for sequences s2 (Lorenz binary chaotic sequence) and s3 (Chua binary chaotic sequence) indicate a relatively low entropy level, much lower than the desired value of around 8 (see the sequence s1 in Table 1). This was caused by the bias phenomenon-long intervals of the same bits. Thus, neither s2 nor s3 can be considered a random sequence with high levels of entropy, and the von Neumann correction [24] is certainly recommended for those individual sequences. The logistic chaotic bit sequence s4 performed surprisingly well with a high entropy level (the length of data in Y j is 32 bits; see Figure 1), and much poorer if the length was only 10 bits (sequence s5 in Table 2). In order to secure a much wider diversity in creating chaotic sequences with excellent randomness features, we examined how the sequences obtained from our mixed-mode XORing operations performed in the six tests. The sequences s6 and s7 (obtained with the XOR operations) had very good test results, certainly comparable with the results for sequence s1. One may argue that there was no significant improvement in the test when considering s4 and s6 (or s7) sequences. However, even in this case, by using the mixed-mode signals, we had the comfort of not having identical sequences that could be obtained when only a logistic map is used with the same initial seed values. Clearly, if we used the logistic map only with data of 10 bits (sequence s5), then such a single-source generator would fail most of the tests, and s5 would be of a low entropy level. XORing either s2 with s5 or s3 with s5 in our mixed-mode generator created sequences s8 and s9, respectively. These sequences had better test results than s5 alone: the entropy level was increased two-fold. The compression levels, AMV values and MC π percentages for s8 and s9 sequences were also improved when compared to the s5 sequence. Our results of the MC π test were at the desired 1-2% level for s6 and s7. Such results are typically obtained with much longer sequences [25]. The results of the χ 2 test for s6 and s7 are also much better than those of s2 and s3 (and even of s1). As described in [25], the χ 2 values of weakly random sequences are large, but are small for truly random sequences. This is clearly shown in Table 2. Those results are also confirmed by the lower compression levels for s6 and s7, which are in the range of 1-2%, comparable with the compression level for s1. Furthermore, let us not forget that none of the sequences s6, s7, s8 and s9 underwent the von Neumann correction. Overall, these sequences have good characteristics of random sequences, often comparable with those obtained from the professional quantum random number generators, such as the one used in this paper to generate sequence s1.  Figure 11. Scatter plots of sequences s1-s9, each with 100 × 100 bits.

Conclusions
At the present time, the methods of designing chaotic bit generators lack protection against problems involving finite lengths of bits in number representations, which may result in low entropy levels for the generated chaotic signals. Furthermore, the possibility of reusing of the same seed values (initial conditions) is not properly addressed [7][8][9]. To deal with those serious problems, we have proposed a technique of mixing for chaotic bit sequences that yields an increased level of chaotic quality (increased parameter K in the 0-1 test) and increased entropy levels. The improvement is due to mixing two independent chaotic inputs (continuous and discrete). The performed computational analysis confirmed the strong chaotic nature of the resulting output, as evidenced by the K values close to 1 and the irregularity of the q − p shapes in the 0-1 test.
The monitoring system built to check the real-time performance of the mixed-mode generator (based on our XORing technique) can utilize a graphical result in the form of a 2D q − p plot, supplemented by the easy to interpret number K from the 0-1 test. A decrease in K would indicate worsening of the quality of chaotic output and could indicate improper work of such a generator, due to a failure of electronic circuits generating the two input sequences. Another reason for decreasing the values of K could be unauthorized hardware modifications defined as hardware attacks or hardware Trojans [26]. They occur in the forms of parameter or circuit diagram changes, and have lately become a hot research topic [27][28][29][30]. Similarly, the interdisciplinary research topic (physics-electronics) of untrusted devices has become important in recent years, too [31].
Finally, the method presented in this paper can be applied to any chaotic signals, irregardless on whether or not they come from a system with one or many chaotic attractors [32,33]. One area of research worth examining is to check how the 0-1 test for chaos behaves when the number of chaotic attractors increases.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A. The 0-1 Test (for Chaos)
The 0-1 test was developed by Gottwald and Melbourne [13][14][15]. Certain problems with using the 0-1 test for continuous dynamical systems have been reported in [16]. Here is a concise summary of the test.
The test results have two forms: a single real number 0 ≤ K ≤ 1, and a twodimensional graph of variables (p c (n), q c (n)) [13]. When a chaotic sequence is fed into the test, the number K should be close to 1, whereas for regular sequences the number K should be close to 0. There are two methods of computation K: regression or correlation. with n = 0, . . . , N − 1 and a randomly chosen real number c ∈ (0, π). Then, the quantity M c (n), n = 0, 1, . . . , n cut , called the mean square displacement of p c (n) and q c (n), is computed as follows: with the recommended value n cut ≈ (N − 1)/10. If the regression method is applied, then the K c value, the asymptotic growth rate of the mean square displacement, is computed as follows: with the cov and var denoting their covariance and variance, respectively [13]. In both the regression and correlation methods, the above steps are repeated for N c values of c chosen randomly from the interval (0, π). It is recommended that N c = 100. Computing the median of the N c values of K c yields the number K. All sequences tested in this paper by the 0-1 test had a length of 5000 real values.