1. Introduction
At present, with the rapid development of embedded technology, mobile communications, and the Internet, information security has become increasingly significant. As one of the important means to ensure information security, the encryption algorithm has been widely used. Among the symmetric encryption algorithms, serial ciphers maintain advantages in wireless secure communications and dedicated encryption machines due to their simple structure, easy hardware implementation, limited error propagation, and fast encryption speed. Sequence ciphers are also called stream ciphers. For such ciphers, the pseudo-random bit generator (PRBG) is its core component. The quality of a stream cipher mainly depends on the complexity and randomness of the binary sequence (i.e., keystream) generated by PRBG. Traditional PRBGs are generally constructed based on m-sequence or M-sequence, which has good noise-like, autocorrelation, run-length distribution, and 0–1 balance. However, m-sequences are constructed based on linear feedback shift registers and primitive polynomials, and their linearity is easy to be cracked. The construction of nonlinear M-sequences has not yet been completely solved theoretically, and there are few construction methods. On the other hand, while traditional cryptography is being studied, chaotic systems have attracted extensive attention from relevant scholars because of their good characteristics such as initial value sensitivity, noise-like, topological transitivity, ergodicity, and long-term unpredictability [
1]. Using chaos theory to design PRBG has become a new direction of current research. In recent years, related scholars have also proposed a variety of PRBGs based on chaotic systems [
2,
3,
4]. The pros and cons of the chaotic pseudo-random sequence generator mainly depend on the randomness and complexity of the chaotic binary sequence. Therefore, a comprehensive evaluation of the performance of chaotic binary sequences has become a crucial criterion for measuring the security of chaotic ciphers.
In fact, as early as 1993, Stamp [
5] studied the complexity measurement of 0–1 binary sequences and proposed a
k-error linear complexity to analyze the sequence performance. In ref. [
6], Feng et al. also innovatively designed a fixed period distance to measure the stability of the binary sequence. Subsequently, Elfeky et al. [
7] designed a period mining algorithm to monitor the period phenomenon of discrete time series in real time. In 2005, when studying the linear complexity and stability of periodic sequences, Niu et al. [
8] proposed a basic framework based on lattice structure to analyze the performance of sequences. In 2012, Ahadpour et al. [
9] proposed the topological properties of the binary visibility graph as a randomness criterion from the complex network’s perspective. In 2019, Fatih et al. [
10] put forward a new family of statistical randomness tests for a collection of binary sequences. This test can analyze periodic templates of binary sequences and evaluate the performance of the sequence. At present, related scholars generally use common detection methods for performance analysis of chaotic binary sequences, such as autocorrelation detection, discrete Fourier transform, linear complexity [
11,
12], entropy theory [
13,
14,
15], frequency test, etc. In addition, several statistical test suites for binary sequences have also been developed successively, such as TestU01 [
16], NIST SP800-22 [
17], Diehard [
18], and GM/T 0005-2012. These test specifications contain several detection items, which can analyze and evaluate the randomness of binary sequences from different angles.
However, due to the limited calculation accuracy of hardware equipment, binary quantization methods and rounding errors, the performance of chaotic binary sequences has been degraded to varying degrees [
19,
20,
21,
22]. In recent years, scholars in related fields have surprisingly discovered that some chaotic binary sequences emerge as locally weak random phenomena, that is, a measurable short sequence will periodically appear in a certain local range of the chaotic binary sequence. The local instability of the chaotic binary sequence is easily ignored. From the perspective of encryption, the appearance of this phenomenon is bound to affect the security and anti-attack ability of chaotic sequence ciphers. This phenomenon is difficult to locate and evaluate accurately by employing commonly used detection methods such as frequency detection, autocorrelation, poker detection, approximate entropy, overlapping subsequence, and binary derivation. Based on the above problems, Zheng et al. [
23] proposed a binary sequence cycle monitoring method based on run-length characteristics to locate multiple periodic phenomena in a chaotic binary sequence. Nevertheless, this method can only detect part of the periodic phenomenon contained in the chaotic binary sequence, and the weak random phenomenon with a short period template cannot be accurately located. In order to compensate for the shortcomings of the aforementioned method, we designed a multi-period positioning algorithm (MPPA) based on the periodic detection matrix and monotonic stack technology. This algorithm can precisely locate the accurate period and local period phenomena contained in the chaotic binary sequence. Related experimental results also demonstrate the effectiveness and correctness of the proposed algorithm. MPPA enriches the set of randomness detection methods for chaotic binary sequences and provides a new idea for the analysis of the security of chaotic stream ciphers.
3. A Multi-Period Positioning Algorithm
In order to effectively detect the existence of the local periodic phenomenon in a binary sequence, that is to say, whether a weak randomness problem occurs in the local range of this sequence, in this section, we propose a multi-period positioning algorithm (MPPA) to enrich the set of randomness detection methods for binary sequences. The specific implementation steps of this algorithm are as follows:
Step 1. First, for an arbitrary chaotic binary sequence
with length
, we define a
two-dimensional matrix
as the sequence reconstruction matrix of the binary sequence
.
is the corresponding element in matrix
and satisfies the equation
. Furthermore, the sequence reconstruction matrix
is defined as
where the symbol
denotes inclusive or logic operation.
and
are the
and
elements of the chaotic binary sequence
respectively. Here, we define the main diagonal of matrix
as the first diagonal, which is composed of an element set
. The diagonal formed by the element set
is the second diagonal of matrix
. By analogy, matrix
can form
diagonal lines. Moreover, if the binary sequence
satisfies the equation
, there is a run of ones with the length
between the
and
elements of the
diagonal line of matrix
. Obviously, matrix
can reflect the local periodic phenomenon of sequence
to some extent.
Step 2 Next, we can assume that
is equivalent to the
diagonal line of matrix
, where
and
.
is the number of elements contained in
, i.e., the length of the
diagonal line. Furthermore, a
period detection matrix
can be generated by folding
with period
. Here, if the length
of sequence
is even,
. If
is odd,
. Then, the variable
can be given as
where
denotes rounding down operation. Based on the above process, the matrix
can be constructed to detect the existence of traditional and local periodic phenomena in a binary sequence
. The two-dimensional matrix
can be expressed as
Then, the matrix
is further operated to obtain the final period detection matrix
, and the mathematical expression of matrix
can be defined as
The following correlation exists between the matrices and :
- (1)
Assume that () is any element in matrix . If , ;
- (2)
For element
(
), if
,
. In contrast, if
, we observe the number of consecutive 1s above the element
in the
column of matrix
. If the number of consecutive 1s is
, then
. Here, we can exemplify the above relationship, suppose the two-dimensional matrix
is
Next, the period detection matrix
can be obtained as follows:
Step 3. Based on the period detection matrix , the multi-period phenomena contained in the chaotic binary sequence can be detected and located. First, the last row element in matrix is extracted to construct a one-dimensional vector . After that, the value of the elements in the vector is successively judged. If each element of vector is equal to , then the binary sequence has an exact periodic phenomenon with length . If an exact period is detected in the binary sequence , we do not need to detect the local period phenomenon. If the binary sequence does not contain the exact period, it is necessary to further check whether there is a local periodicity in the local range of the sequence .
Next, the monotone stack theory can be used to detect and locate the local periodicity of the binary sequence . A monotone stack is a data structure, which is divided into monotone increasing stack and monotone decreasing stack. The specific execution process of local periodic detection is to scan the elements in the periodic detection matrix row by row to search for continuous nonzero element segments. Suppose that there is a nonzero element segment with length in the row, that is, each element in the element segment is a positive integer. Furthermore, a zero element is added to the tail of the element segment to construct a new element segment , with length , where . After performing the above operations, can be used as the input parameter of the local periodic positioning algorithm (LPPA) to judge whether there is a local periodicity in this range. The LPPA is presented as Algorithm 1 in pseudocode. In this algorithm, variable thres denotes the decision threshold of local period and . The larger the decision threshold is, the more obvious the local periodicity of the chaotic binary sequence is. In general, the decision threshold should be greater than or equal to 0.03.
LPPA adopts monotonic decreasing stack technology. A set of key values (
c-
Width,
c-1,
High) can be obtained after each execution of the local cycle positioning algorithm. Based on this set of key values and the column coordinate
p of the first element of
, we can deduce the start point (
Start =
p +
c-
Width) and the endpoint (
End =
p +
c-1) of the period template. Furthermore, the precise location of the local period contained in the chaotic binary sequence
can be expressed as
Based on the above operation steps, we can accurately locate whether there is an exact period and local period in any chaotic binary sequence. This algorithm evaluates the randomness of chaotic binary sequences from a new perspective and then compensates for the shortcomings of existing randomness detection methods.
Algorithm 1 Local periodic positioning algorithm (LPPA) |
1: Define a stack, the width, height, and area of the “1” block: Stack, Width, High, BlockArea 2: for c from 0 to l do 3: while !Stack.isEmpty() && u(stack.top()) > u(c) do 4: High←u(stack.top());//stack.top() denotes stack top. 5: while !Stack.isEmpty() && High == u(stack.top()) do 6: Stack.pop(); 7: end while 8: Width←0; 9: if Stack.isEmpty() then 10: Width←c; 11: else 12: Width←c-Stack.top()-1; 13: end if 14: BlockArea←Width*High; 15: if (BlockArea + Width) >= n*thres then 16: Output a set of variables (c-Width, c-1, High); 17: end if 18: end while 19: Stack.push(c); 20: end for |
4. Randomness Tests of Chaotic Binary Sequences
In this section, in order to verify the effectiveness and practicability of the proposed algorithm, MPPA and several commonly used detection methods are performed to comprehensively test the performance of logistic chaotic binary sequences under different calculation accuracy. The iterative equation of the digital logistic map in integer domain [
24] is given by
where
denotes rounding down operation;
and
represent the control parameter and the finite computational precision, respectively. We adopted incremental quantization to binarize the discrete logistic sequence. Incremental quantization is also called direction quantization, which is defined as
where
, that is, the difference between two adjacent chaotic iteration values. If
is less than 0, the result of quantization is 0; otherwise, the result is 1.
and
are the chaotic real-valued sequence and the quantized binary sequence, respectively. Obviously, the chaotic binary sequence generated by the incremental quantization method reflects the motion trajectory of the chaotic map to a certain extent. Based on Equation (10), we used incremental quantization to generate different logistic binary sequences, with calculation accuracies of
m = 8, 16, and 32. In addition, numerical simulations were performed to assess the performance of the logistic binary sequences in terms of autocorrelation, permutation entropy, linear complexity, and MPPA.
4.1. Autocorrelation Test
The autocorrelation test was used to detect the correlation degree between the binary sequence
and the new sequence obtained by shifting the sequence to the left by
d bits. The test method is generally realized by the autocorrelation function of the binary sequence
, and its mathematical formula can be expressed as
where
and
denote autocorrelation function and the length of the chaotic binary sequence, respectively. Based on Equation (11), an autocorrelation test was carried out for logistic binary sequences with different calculation accuracy, and simulation results are shown in
Figure 2. According to
Figure 2a, when the calculation accuracy
m is equal to 8, the autocorrelation function of the logistic binary sequence has extremely dense peaks with approximately equal amplitude, which indicates that the binary sequence has strong autocorrelation and short periodicity. When the calculation accuracy
m = 16, the peak density of the autocorrelation function for the binary sequence with a length of 1000 is reduced. Here, it still has multiple spectral lines, which still shows a certain degree of correlation and periodicity. From
Figure 2c, we can observe that the waveform of the autocorrelation function is like an impulse function
. From the perspective of the autocorrelation test, the chaotic binary sequence has good randomness. In fact, there are still local weak random features.
4.2. Permutation Entropy
In 2002, Bandt and Pompe [
25] proposed a measurement method to analyze the complexity of discrete time series—namely, permutation entropy (PE). This method has many advantages, such as strong robustness, fast-computing speed, and invariance of nonlinear monotonic transformation. Therefore, it has been widely used to evaluate sequence complexity in recent years. The range of permutation entropy is between 0 and 1. The larger the value, the better the randomness, and the higher the complexity of the discrete chaotic sequence. In this section, the permutation entropy of the logistic binary sequences with different calculation accuracy is calculated. The two parameters of PE (i.e., embedding dimension
and delay time
) are set as 6 and 1, respectively. The experimental results are listed in
Table 1. According to
Table 1, with the increase in the calculation precision, the permutation entropy of the logistic binary sequences also gradually increases. When the calculation precision
m is 16 or 32, the permutation entropy is better than the PE value of the logistic binary sequence with the precision
m = 8. However, when the calculation precision
m = 32, the permutation entropy of the binary sequence is only 0.44276, which is still far from the ideal value of 1.
4.3. Linear Complexity
Linear complexity (LC) is one of the important means to evaluate the performance of binary sequences. The linear complexity of binary sequences is usually calculated using the Berlekamp–Massey algorithm. The algorithm is very efficient for determining the linear complexity of a finite binary sequence. For a chaotic binary sequence with length
N, if the linear complexity of the sequence is half of its length, it is considered that the binary sequence has desirable linear complexity. In this section, the linear complexity of logistic binary sequences with different calculation accuracy is calculated, and the numerical results are illustrated in
Figure 3. As can be seen from
Figure 3a, when the length of the logistic binary sequence exceeds 9 bits, its linear complexity is always equal to 5. That is to say, the binary sequence can be equivalently generated by constructing a five-order LFSR. Similarly, when the calculation accuracy
m = 16, it can be equivalently generated by only constructing an 87-order LFSR. According to
Figure 3b, when the length of the binary sequence increases, the linear complexity of the logistic binary sequence remains at a low value. Nevertheless, from
Figure 3c, the value of linear complexity fluctuates up and down along the straight line
N/2, which shows that the binary sequence has ideal linear complexity.
4.4. MPPA Test
The above-mentioned test methods analyze the performance of logistic binary sequences from different angles, but none of them can accurately locate and detect the locally weak randomness phenomenon of the binary sequence. In this section, the proposed algorithm (i.e., MPPA) is used to analyze the local randomness of chaotic binary sequences with length 1000, which can comprehensively evaluate the performance of binary sequences from a new perspective. For explanatory convenience, let us assume that
denotes a logistic binary sequence, where
m and
represent the finite computational precision and the initial value of the digital logistic map. The decision threshold of MPPA is set as 0.03, and the experimental results are shown in
Figure 4. It can be seen from
Figure 4a,b that the logistic binary sequences
and
have exact periodic phenomena with period lengths
and 79, respectively. According to
Figure 4c, when the computational precision
m = 32, we observe that the sequence
contains a local period with length
. Moreover, the position of the period template
(i.e., the bit string 10101101) can be precisely located between the 10th row, 30th column, and 13th row, 37th column. According to the results of the MPPA test, the logistic binary sequences have certain exact periodic and local periodic phenomena.
The above experiment was designed to analyze the local randomness of the original logistic binary sequence under different calculation precisions. The experimental results show that it has obvious precise period and local period phenomenon. For comparison, we also carried out the MPPA test for the improved logistic sequence. As an example, the improved logistic sequence proposed in Ref. [
22] can be used as a sequence to be detected. When the MPPA test was performed on the improved logistic binary sequence and the decision threshold
thres was set to the recommended value (e.g., 0.03), the test result shows that the binary sequence has neither precise period nor local period phenomenon. Furthermore, the test result for when
thres was set to a non-recommended value of 0.01 (small enough) is shown in
Figure 5. It can be observed that the sequence contains an insignificant local period, with length
. The position of period template
(the bit string 1011 is short enough) can be located between the 4th row, 92nd column, and 6th row, 95th column. The experimental results show that the binary sequence has no local weak random phenomenon under the recommended threshold value. Only when the
thres is reduced to a non-recommended value of 0.01 can the sequence detect the local period with a small periodic template, which shows that the local periodic phenomenon of the improved binary sequence is not obvious and ignorable. In addition, we also conducted MPPA tests on some of the currently proposed robust chaotic generators (e.g., Refs. [
26,
27]), and the experimental results show that the correlated binary sequences do not exhibit obvious local periodicity. Based on the above experiments, we can conclude that the use of periodic cycle jumps, construction of high-dimensional chaotic systems with high Lyapunov exponent, and decorrelation transformation can effectively reduce the local periodic phenomenon of chaotic binary sequences and improve the randomness of sequences.