1 Introduction

Over the past 10 years, the chaotic map has been attracting more and more interests from researchers in the field of cryptography. It has been widely applied to secure communication and encryption algorithms. In the encryption algorithm, the chaotic map is usually used as the core component to generate pseudorandom sequences. Then, the plain message is masked or encrypted by the sequences from chaotic maps, which is the general idea of designing chaos-based cipher [17]. Thus, the cryptographic properties of the sequences generated from chaotic map are very important to the security of encryption algorithms. The logistic map is one of the popular chaotic map used in chaos-based cryptography, which has been widely used in block cipher [6, 7], stream cipher [8, 9] and Hash function [10, 11]. Although logistic map owns some advantages from chaotic system, it still has some inherent problem from the view of cryptography, such as uneven density probability distribution. The security problems of logistic map are presented and some encryption schemes based on logistic map are cryptanalyzed [12, 13]. Thus, it is necessary to improve the cryptographic properties of logistic map. In this paper, the enhanced form of logistic map, i.e., the piecewise logistic map (PLM) is presented. Some cryptographic properties of this chaotic map are analyzed by numeric method and compared with the logistic map. The results show that the PLM has better cryptographic performance than the logistic map. Furthermore, to improve the density probability distribution of the PLM, the piecewise logistic map with variable parameter (PLMVP) is suggested. These researches on enhancing the cryptographic performance of the chaotic map benefit the designing of pseudorandom number generator and encryption algorithm.

In stream cipher, the pseudorandom number generator (PRNG) is one of the most important components. Recently, some PRNGs are proposed based on chaotic systems [1418]. To achieve high speed, a simple chaotic map, such as tent map or logistic map, is iterated to generate pseudorandom numbers. Although one-dimensional chaotic system has the advantages of high-level efficiency and simplicity, there are fundamental drawbacks in this chaotic cryptosystem, such as small key space and weak security [12, 19]. Most of the PRNGs based on chaos are obtained directly by sampling the trajectory of the chaotic map. In this case, some information of the chaotic map is probably exposed, which leads to some loopholes. Moreover, methods for predicting chaotic time series have been suggested [2022]. To prevent attackers from breaking the PRNG by predicting the chaotic series, complex chaotic system should be considered. In Refs. [23, 24], high-dimensional chaos and spatiotemporal chaos are applied to design PRNG. Owing to making full use of the traits of a complex system, the algorithms satisfy the security requirement of PRNG. However, more computation is needed in these algorithms, when producing pseudorandom numbers. Therefore, further studying PRNG on the trade-off between efficiency and security is needed.

In this paper, the PRNG is proposed based on the PLM, which is an enhanced version of logistic map. To break the relation between the chaotic sequences and the pseudorandom numbers, some special operations, such as substitution and feedback, are employed in our scheme. Theory analysis and simulation tests both confirm that the proposed PRNG is simple, secure, and efficient. The rest of the paper is organized as follows. Section 2 analyzes the logistic map and its cryptographic properties. In Sect. 3, the PLM is defined and its properties related to cryptography are discussed. The PLMVP with better uniform density probability is presented in Sect. 4. The new PRNG and its performance are discussed in Sects. 5 and 6, respectively. Finally, conclusion is drawn in Sect. 7.

2 Logistic map

The logistic map is a simple chaotic map often used to describe the growth of biological population. The logistic system has very complex dynamic behavior, which has been widely applied to data security and secure communication [3, 4, 25]. The logistic map is a discrete-time dynamic system, being mathematically expressed as

$$\begin{aligned} x_{n+1} =f({x_n})=\mu x_n ({1-x_n}) \end{aligned}$$
(1)

where \(x_{0} \in (0,1)\) is the state value and \(\mu \) is the control parameter. When \(\mu \in [3.57, 4]\), the logistic map is in chaotic status.

Fig. 1
figure 1

Chaotic attractors of the logistic map for different \(\mu \)

2.1 Ergodicity of logistic map

In statistics, the ergodicity describes a random process for which the time average of one sequence of events is the same as the ensemble average. The ergodicity can be expressed by the statistics distribution of state value. In Fig. 1, the logistic map is plotted for different \(\mu \). It can be seen from Fig. 1 that the maximum state value of the logistic map is smaller than 1 when \(\mu <4\). Moreover, the maximum state value of logistic map becomes smaller with the decrease of \(\mu \). It means that the ergodicity of logistic map in interval [0, 1] becomes better with the increase of \(\mu \).

To further demonstrate the ergodicity changes of logistic map with the control parameter, the following numeric experiment is done:

  1. (1)

    Fix the value of control parameter \(\mu \) and randomly set the initial value \(x_{0}\).

  2. (2)

    Iterate the logistic map for 10,000 times.

  3. (3)

    The distribution of the logistic state values is plotted.

The experiment is repeated for different \(\mu \) and all results are shown in Fig. 2. According to Fig. 2, we can see that the logistic map has the best uniform distribution and ergodicity when \(\mu \) is 4. The results as shown in Fig. 2 also confirm that the ergodicity of logistic map in interval [0, 1] becomes better with the increase of \(\mu \).

2.2 Bifurcation of logistic map

In the dynamic system, the bifurcation diagram shows the qualitative changes of a system as a map of parameter. The period-doubling bifurcation of the logistic map is depicted in Fig. 3. Since the map is surjection in the intervals (0, 1), the separation speed of period-doubling orbit of the logistic map is the fastest when \(\mu \) is 4.

2.3 Lyapunov exponent of logistic map

For dynamical systems, the Lyapunov exponent characterizes the velocity of evolution between two near trajectories. For function \(x_{n+1} =f({x_n})\), its Lyapunov exponent \(\lambda \) is defined as follows [2628]

$$\begin{aligned} \lambda = \lim _{n\rightarrow \infty } \frac{1}{n}\sum _{i=0}^{n-1} {\ln |{f^{{\prime }}(x_n)}|} \end{aligned}$$
(2)

A quantitative measurement of chaotic behavior of the function is given by the positive values of Lyapunov exponent (i.e., \({\lambda } >0\)). The Lyapunov exponent of the logistic map is calculated by quantitative method under the condition that the control parameter \(\mu \) is changed from 3 to 4 with step 0.01. The distribution of Lyapunov exponents is shown in Fig. 4. Based on Fig. 4, it can be seen that the Lyapunov exponent of the logistic map begins to be greater than 0 when \(\mu >3.57\). Meanwhile, there are some points less than 0 when \(\mu \in [3.57,3.9]\). Most Lyapunov exponents become positive and their values are greater when \(\mu \in [3.9,4]\). Thus, the logistic map has more stable chaotic behavior when \(\mu \in [3.9,4]\).

Fig. 2
figure 2

The state value distribution of logistic map for different \(\mu \)

2.4 Density probability of logistic map

The density function of logistic map for \(\mu =4\) is illustrated by numeric simulation in Fig. 5 [29]. Obviously, the density distribution of the logistic map is not uniform, which means that the sequence directly generated by this chaotic map probably has no enough good random properties.

3 The PLM

According to the analysis in Sect. 2, the logistic map has some potential problems, such as mediocre ergodicity and uneven density probability, when it is applied to designing encryption algorithms. In order to further improve the cryptographic properties, we present an enhanced version of the logistic map, i.e., the PLM, which is defined by

$$\begin{aligned}&x_{j+1}=\hbox {PLM}(x_j)\nonumber \\&\quad =\left\{ \begin{array}{ll} N^{2}\mu x_j\left( \frac{1}{N}-x_j \right) ,&{} 0<x_j<\frac{1}{N}\\ 1-N^2\mu \left( x_j-\frac{1}{N} \right) \left( \frac{2}{N}-x_j \right) , &{} \frac{1}{N}<x_j<\frac{2}{N}\\ \vdots &{}\\ N^2\mu \left( x_j-\frac{i-1}{N} \right) \left( \frac{i}{N}-x_j \right) , &{} \frac{i-1}{N}<x_j<\frac{i}{N}\\ 1-N^2\mu \left( x_j-\frac{i}{N} \right) \left( \frac{i+1}{N}-x_j \right) , &{} \frac{i}{N}<x_j<\frac{i+1}{N}\\ N^2 \mu \left( x_j -\frac{N-2}{N} \right) \left( \frac{N-1}{N}-x_j \right) , &{} \frac{N-2}{N}<x_j<\frac{N-1}{N}\\ 1-N^2\mu \left( x_j-\frac{N-1}{N}\right) (1-x_j), &{} \frac{N-1}{N}< x_j<1\\ x_j+\frac{1}{100N}, &{} x_j=0,\frac{1}{N},\frac{2}{N},\ldots ,\frac{N-1}{N}\\ x_j-\frac{1}{100N}, &{} x_j=1\\ \end{array}\right. \nonumber \\ \end{aligned}$$
(3)

where \(x_{j} \in (0,1)\) is the state value of PLM, \(\mu \in (0,4]\) is the control parameter, and N is the segment number of the PLM. For example, when \(N = 4\) and \(\mu =4\), the PLM can be expressed in the form

Fig. 3
figure 3

Bifurcation diagram of the logistic map

Fig. 4
figure 4

The Lyapunov exponents of the logistic map

$$\begin{aligned} x_{j+1}=\hbox {PLM}(x_j)= \left\{ \begin{array}{ll} 64x_j \left( \frac{1}{4}- x_j \right) , &{} 0<x_j< \frac{1}{4}\\ 1-64 \left( x_j-\frac{1}{4} \right) \left( \frac{1}{2}-x_j \right) , &{} \frac{1}{4}<x_j<\frac{1}{2}\\ 64x_j \left( x_j-\frac{1}{2}\right) \left( \frac{3}{4}-x_j \right) , &{} \frac{1}{2}<x_j<\frac{3}{4}\\ 1-64x_j \left( x_j-\frac{3}{4} \right) (1-x_j), &{} \frac{1}{4}<x_j<1\\ x_j+\frac{1}{400}, &{} x_j=0,\frac{1}{4},\frac{1}{2},\frac{3}{4}\\ x_j-\frac{1}{400}, &{} x_j=1\\ \end{array}\right. \nonumber \\ \end{aligned}$$
(4)

and plotted in Fig. 6.

To compare the PLM with the logistic map, we have performed the following test: For the PLM with fixed \(\mu =4\), set \(N = 4\) and randomly select an initial state value of PLM. Then, the PLM is iterated for 30 times. Finally, the state values are plotted in Fig. 7. Repeat performing this test with the same initial value but different N. Moreover, the test result of the logistic map is also illustrated in Fig. 7. It can be seen from Fig. 7 that the sequences generated by the PLM and the logistic map are total different. Furthermore, we change the initial state value and repeat the comparison mentioned above. The same result is obtained, which means that the PLM is not related to the logistic map and it is a new map.

Fig. 5
figure 5

Density probability distribution of the logistic map

Fig. 6
figure 6

The piecewise logistic map when \(N = 4\) and \(\mu =4\)

Fig. 7
figure 7

The state values of the PLM and the logistic map

Fig. 8
figure 8

The curves of the PLM for different \(\mu \)

3.1 Ergodicity of the PLM

Here, we give some simulation test to show the ergodicity changes of the PLM. The curves of the PLM for different \(\mu \) are shown in Fig. 8, where \(N=4\). It can be seen that the PLM occupies the whole intervals (0, 1) when \(\mu \in [2,4]\). As we know from Fig. 1, the logistic map can achieve the same result when \(\mu \) is only 4. Moreover, the state value distributions of the PLM with different \(\mu \) and N are obtained by the same method in Sect. 2.1. They are shown in Fig. 9. According to Fig. 9, it can be concluded that: (1) The sequences generate by the piecewise logistic map with different N has good randomness when \(\mu \in [2,4]\). (2) Compared with Fig. 2, the value range of \(\mu \) corresponding to good ergodicity is extended with the increase of N, which means that the ergodicity of PLM is improved.

Fig. 9
figure 9

The distribution of state value of piecewise logistic map

Fig. 10
figure 10

Bifurcation diagrams of the PLM

Fig. 11
figure 11

Lyapunov exponents with variable N

Fig. 12
figure 12

Lyapunov exponents with variable \(\mu \)

Fig. 13
figure 13

Density probability of the PLM

3.2 Bifurcation of the PLM

In this section, we discussed the period-doubling bifurcation of the PLM with different N. With numeric method, the bifurcation diagrams of the PLM for different N are plotted in Fig. 10, where the initial value is a random value. In Fig. 10, the control parameter \(\mu \) is shown on the horizontal axis and the vertical axis shows the possible long-term status values of PLM. It is clear by comparing Fig. 10 with Fig. 3 that the value of \(\mu \) corresponding to the starting point of the PLM falling into chaos is smaller than that of logistic map. Furthermore, the value of \(\mu \) corresponding to the starting point of the PLM being chaotic becomes smaller with the increase of N.

3.3 Lyapunov exponent of the PLM

Since \(\mu \) and N both affect the Lyapunov exponent, only one parameter is varied each time with the other parameter fixed, so as to observe the influence of the varying parameter on the Lyapunov exponent. The Lyapunov exponents with various \(\mu \) or N are shown in Figs. 11 and 12, respectively.

According to the result of numerical analysis in Figs. 411 and 12, some conclusions are drawn below:

  1. (1)

    The Lyapunov exponent of the PLM is increased with the increase of N when \(\mu \) is fixed.

  2. (2)

    With the increase of N, the interval of \(\mu \) corresponding to the positive Lyapunov exponent becomes wider.

  3. (3)

    Compared with the logistic map, the PLM has greater Lyapunov exponent when the parameter \(\mu \) is set as the same value.

3.4 The density probability of the PLM

By the method in the Sect. 2.4, we analyze the density probability of the PLM for different N and \(\mu \). All of them have almost the same result as the logistic map when \(\mu \) is 4. Moreover, the density probability of the PLM is also not uniform, and the intervals corresponding to the higher density probability are different when \(\mu \) is changed. Here, we only give the density probability of the PLM with \(N=64\) and \(\mu =1, 2, 3, 4\) as an example, which is shown in Fig. 13.

4 The PLM with variable \(\mu \)

Since the density distribution of the PLM is not uniform, the numbers directly generated by this chaotic map is also uneven. It means that the sequences from the PLM probably has no good enough random properties. To remedy this problem, we present a PLMVP, whose parameter \(\mu \) is changed when each iteration of the piecewise logistic map is completed. The PLMVP is defined as \(h(x_0, \mu _0, s,m)\), where \(x_{0} \in (0, 1)\) and \(\mu _{0} \in (m, 4-m)\) are the initial state value and the initial control parameter value, respectively; s is the step value of changing control parameter \(\mu \); m is the parameter used to control the scope of \(\mu \). To get good chaotic properties, we suggest \(m \in (0.01, 0.1)\). The pseudo codes in Fig. 14 illustrate the iteration process of the PLMVP. By controlling the condition in the pseudocodes, we can obtain as many chaotic state values from PLMVP as we want.

Fig. 14
figure 14

The pseudocode for implementing the PLMVP

Fig. 15
figure 15

Density probability distribution of piecewise logistic map

The density probability of the PLMVP is got and shown in Fig. 15. Here, \(x_{0}\) and \(\mu _{0}\) are randomly set and sm are 0.001 and 0.01, respectively. By comparing Fig. 15 with Figs. 5 and 13, it is obvious that the PLMVP has much more uniform density probability distribution than that of PLM and logistic map.

5 The proposed pseudorandom number generator

5.1 Notations

A pseudorandom number generator (PRNG), also known as a deterministic random number generator, is an algorithm or a device for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers [8]. The PRNG is very important in applications such as simulation electronic games and cryptography. We will present our PRNG algorithm based on piecewise logistic map. To the convenience of description and understanding, the notations in our algorithm are firstly listed in Table 1.

5.2 The algorithm

Cryptographic applications require the output not to be predictable from earlier outputs. Thus, the sequence generated by any PRNG must have the following characteristics: (1) The output of the PRNG has good statistical properties; (2) For any initial values, the PRNG generated the sequence has no shorter periods; (3) The correlation of successive values is poor in the sequence. Base on the PLM, a novel pseudorandom number generator is proposed. The whole process of generating pseudorandom numbers is described as follows and an illustration is given in Fig. 16.

Step 1:

Choose the PLM with \(N =64\) as the chaotic map to generate pseudorandom numbers. Then, initialize the control parameter \(\mu \) of the PLM and set the initial values of parameters R and m.

Step 2:

Iterate the PLM once. Then, transform the current status value of PLM to the corresponding binary format and extract 8 bits (9th to 16th bits after the decimal point) to obtain an integer K.

Step 3:

Generate an 8-bit output number according to the following equation

$$\begin{aligned} P=K\oplus S(R) \end{aligned}$$
(5)

where function S (x) returns the substitution value of x according to the S-box of AES [30], which is expressed in hexadecimal form in Table 2.

Step 4:

Update the value of register R, i.e., \(R=K\).

Step 5:

By using P as a feedback, adjust the value of \(\mu \) according to the following steps

(i):

\(\mu =\mu +P/256\)

(ii):

\(\hbox {if } \mu >(4-m)\hbox { then } \mu =\mu -(4-m) \)

(iii):

\(\hbox {if } \mu <m\hbox { then } \mu =m \)

Step 6:

To get rid of the transient effect of the chaotic map, the first 1024 generated numbers is omitted. If enough pseudorandom numbers have already been generated, stop this pseudorandom number generator; otherwise, go to Step 3 to generate the next 8-bit pseudorandom number.

Table 1 Notations in the proposed algorithm
Fig. 16
figure 16

Scheme of the proposed PRNG

Table 2 AES S-box: substitution values for byte xy (in hexadecimal format)

6 Performance analysis of the proposed PRNG

6.1 Advantages of the scheme

The PLM is the core component in the proposed PRNG. According to the analysis in Sects. 2 and 3, we may conclude that using the PLM can bring more advantages than using the logistic map. Firstly, the Lyapunov exponent of PLM is greater than that of logistic map when \(\mu \) is the same. It means that the separation rate of the PLM trajectories is larger than that of logistic trajectories. Thus, compared with the logistic map, the PLM is more sensitive to the status value and parameter. The orbit of the PLM is more unstable and its sequence is more complex. Obviously, these properties of the PLM are very useful to designing PRNG.

In the second place, the PLM has wider interval of \(\mu \) corresponding to its chaotic status. As we know, the control parameter is usually employed as the secrete key in the chaos-based cipher. Therefore, the PLM owns larger key space.

Finally, to overcome the problem of uneven density probability, the operation of adjusting \(\mu \) is specially added in our scheme. The value of \(\mu \) is changed after the PLM finishes each iteration, which makes the PLM act as the PLMVP. Thus, the PLM in the presented PRNG scheme can generate the more uniform sequence.

6.2 Statistical testing

In order to gain the confidence that the proposed PRNG is cryptographically secure, the statistical testing should be performed to verify the randomness of the sequences generated by our scheme. As we know, NIST suite of statistical test is one of the most popular options available for analyzing the randomness of PRNGs. In the following subsection, we briefly introduce the tests of NIST suite and give our test strategy [31].

6.2.1 The NIST tests suite

The US NIST statistical test suite provides 15 statistical tests to detect deviations of a binary sequence from randomness. All the 15 statistical tests are briefly introduced as follows. A more detailed description for them could be found in [31].

Frequency test (FT): The purpose of this test is to determine whether the number of ones and zeros in a sequence are approximately the same.

Frequency test within a block (FBT): The purpose of this test is to determine whether the frequency of ones is an M-bit block is approximately M / 2. The default value for M is set to 128.

Cumulative sum test (CST): The purpose of the test is to determine whether the cumulative sum of the partial sequences occurring in the tested sequence is too large or too small relative to the expected behavior of that cumulative sum for random sequences.

Runs test (RT): The runs test is used to determine whether the number of runs of ones and zeros of various lengths is as expected for a random sequence, where a run is an uninterrupted sequence of identical bits.

Test for the longest run of ones in a block (LROBT): The purpose of this test is to determine whether the length of the longest run of ones within the tested sequence is as expected for a random sequence.

Binary matrix rank test (BMRT): The purpose of this test is to check for linear dependence among fixed length substrings of the original sequence.

Discrete Fourier transform test (DFTT): The purpose of this test is to detect periodic features in the tested sequence that would indicate a deviation from the assumption of randomness.

Non-overlapping template matching test (NTMT): The purpose of this test is to reject sequences that exhibit too many occurrences of a given non-periodic pattern.

Overlapping template matching test (OTMT): The purpose of this test is to reject sequences that show deviations from the expected number of runs of ones of a given length.

Maurer’s universal statistical test (MUST): The purpose of the test is to detect whether or not the sequence can be significantly compressed without loss of information.

Approximate entropy test (AET): The purpose of the test is to compare the frequency of overlapping blocks of two consecutive/adjacent lengths (l and \(l + 1\)) against the expected result for a random sequence. The default length of each block is set to 10 bits.

Random excursions test (RET): The purpose of this test is to determine if the number of visits to a state within a random walk exceeds what one would expect for a random sequence.

Random excursions variant test (REVT): The purpose of this test is to detect deviations from the expected number of occurrences of various states in the random walk.

Serial test (ST): The purpose of this test is to determine whether the number of occurrences of the 2-mm bit overlapping patterns is approximately the same as would be expected for a random sequence. The default length of each block is set to 16 bits.

Linear complexity test (LCT): The purpose of this test is to determine whether or not the sequence is complex enough to be considered random, where the linear complexity is determined by the Berlekamp–Massey algorithm.

6.2.2 Testing results analysis

The NIST test suite is a statistical package for testing the randomness of bit sequences, which include 15 tests in edition 2.2. The sequence is random if it passes the 15 tests index, whereas the sequence is insufficient. For each test, a P_value is computed from the binary sequence. If the P_value is greater than a predefined threshold \(\alpha \), then the sequence would be considered to be random with a confidence of \(1-\alpha \) and the sequence passes the test successfully. Otherwise, the sequence fails this test.

In our experiment, \(\alpha \) is set to 0.01, which means a sequence passed the test is considered as random with 99% confidence. 2000 different sequences, each of 1,000,000 bits, are generated by the proposed PRNG. Then, we calculate the P values corresponding to each sequence for all the 15 tests of NIST suite. The test results (i.e., the P_values) are listed in Table 3. The proportion of the sequences passing this particular statistical test is also calculated and compared with the range of acceptable proportion. According to Ref. [8, 29], the range of acceptable proportion is [0.9833245, 0.9966745]. It can be seen from Table 3 that over 98.60% sequences pass all randomness test and the average value is 99.08%. It is clear that proportions for each test lies inside the confidence interval. Thus, the sequence generated by the proposed scheme has good random properties with respect to all the 15 tests of NIST suite.

Table 3 The NIST tests results

Moreover, for each test, the distribution of P values for the 2000 pseudorandom number sequences has been examined by the method in Ref. [8]. The interval (0, 1) is divided into 10 equal subintervals and the count of P values appearing in each subinterval is displayed in Fig. 17. It is clear that the distribution of P values is uniform.

Fig. 17
figure 17

Polygon of P values for the tests of NITST suite (Note the result marked with an asterisk is the average value)

6.3 Correlation evaluation

A correlation coefficient is generally used to measure the dependence and meaning statistical relationships between two or more random variables or observed data values. For two data sequences, the correlation coefficient is defined by

$$\begin{aligned}&\hbox {cov}(x,y)=E\{(x-E(x))(y-E(y))\} \end{aligned}$$
(6)
$$\begin{aligned}&r_{xy} =\frac{cov(x,y)}{\sqrt{D(x)}\sqrt{D(y)}} \end{aligned}$$
(7)

where x and y are the numbers in two data sequences and \(E(x)=\frac{1}{M}\sum \limits _{i=1}^M {x_i}, D(x)=\frac{1}{M}\sum \limits _{i=1}^M {(x_i -E(x))^{2}} \).

To test the correlation performance of our scheme, we generate some pseudorandom sequences with a size of 2000 numbers according to the following conditions:

  1. (1)

    Fix \(\mu , m, R\) and randomly set 1000 initial values of \(x_{0}\), then produce 1000 sequences.

  2. (2)

    Fix \(x_{0}, m, R\) and randomly set 1000 values of \(\mu \), then produce 1000 sequences;

  3. (3)

    Fix \(x_{0}, \mu , R\) and randomly set 1000 values of m, then produce 1000 sequences;

  4. (4)

    Fix \(x_{0}, \mu , m\) and set R from 0 to 255, then produce 256 sequences.

Finally, the correlation coefficients between each pair of the 3256 produced sequences are computed and the distributions of correlation coefficients are shown in Fig. 18. The line graphs show that all the correlation coefficients are very small and close to zero. It means that the present PRNG has good correlation performance.

6.4 Security analysis

6.4.1 Key space

A good PRNG should be sensitive to the key (or seed) and the key space should be sufficiently large to make brute-force attack infeasible. In the proposed scheme, the key consists of the initial status value \(x_{0}\), the parameter \(\mu , m\) and R, where we set \(x_{0}\in (0, 1), \mu \in (0.01, 3.99), m\in (0.01, 0.1)\) and \(R \in [0, 255]\). Suppose the precision of a floating-point number is \(10^{-13}\). Then, x can be any one among those \(10^{13}\) possible values. Similarly, \(\mu \) and m can be any values in the range of \((3.99{-}0.01)\times 10^{13}\) values and \((0.1{-}0.01)\times 10^{13}\) values, respectively. Meanwhile, R is arbitrarily chosen from 255 possible values. Therefore, the key space is about \(9.17\times 10^{40}\), which satisfies the general requirement of resisting brute-force attack. According to the IEEE floating-point standard [32], the computational precision of the 64-bit double-precision numbers is about \(10^{-15}\). Therefore, a sufficiently large key space is guaranteed in the proposed PRNG for practical applications.

Fig. 18
figure 18

Distribution of correlation coefficients on interval [\(-\)0.08, 0.08]

Fig. 19
figure 19

The sequences of under different conditions

6.4.2 Key sensitivity

Key sensitivity refers that only a tiny difference in the key causes a substantial changes in the output. The following key sensitivity tests have been performed:

  • Case 1 \(x_{0}\) is changed from 0.123456789 to \(x_{0}+\Delta \);

  • Case 2 \(\mu \) is changed from 0.987654321 to \(\mu +\Delta \);

  • Case 3 m is changed from 0.012345678 to \(m+\Delta \);

  • Case 4 R is changed from 4 to 5

where \(\Delta = 2^{-44}\). Under these four different cases, the sequences with 2000 pseudorandom numbers are generated and compared with those of the original cases. The first 20 numbers of each case are plotted in Fig. 19. It is clear from Fig. 19 that the sequences are completely different.

Moreover, the correlation coefficients between the origin sequences and their corresponding sequences with a tiny difference in key are calculated according to Eqs. (6) and (7). The results are shown in Table 4. We can see that all the correlation coefficients are very small, which implies that no detectable correlation exists between the original sequence and the four sequences. Therefore, the proposed scheme possesses high key sensitivity.

Table 4 Correlation coefficients between the original sequence and the four sequences
Table 5 The average absolute difference (d) in different cases
Table 6 The numbers of basic operations to generate an 8-bit number

6.4.3 Differential attack

The differential attack is generally applied to cryptanalyze block ciphers, which studies the effect of tiny changes in the plaintexts on their corresponding ciphertexts. However, there is no input plaintext for PRNG. We employ the method in Ref. [16] to test the resistance of differential attack. The following analysis is performed on the initial seeds which are the keys for the pseudorandom number generator.

  1. (1)

    Four sequences (\(S_{1}, S_{2}, S_{3}\) and \(S_{4}\)) with 50,000,000 pseudorandom numbers are generated.

  2. (2)

    The seeds of presented PRNG are changed according to the operations in Sect. 6.4.2. Then, another four sequences \((S_1^{\prime } ,S_2^{\prime } ,S_3^{\prime } \hbox { and } S_4^{\prime })\) with same size are obtained.

  3. (3)

    The average absolute difference between sequence pairs \((S_1 ,S_1^{\prime }), (S_2 ,S_2^{\prime }), (S_3 ,S_3^{\prime })\) and \((S_4, S_4^{\prime })\) are calculated and shown in Table 5. The average absolute difference between two sequences is defined as [16, 33]

    $$\begin{aligned}&d=\frac{1}{M}\sum _{i=1}^M {|{t(e_i)-t(e_i^{\prime })}|} \end{aligned}$$
    (8)

    where \(e_{i}\) and \(e_i^{\prime } \) are the ith ASCII character of the original and the new pseudorandom sequences, respectively. Function t(x) converts the entries to their equivalent decimal values. If \(e_{i}\) and \(e_i^{\prime } \) are two independent variables and the corresponding ASCII values have the uniform distribution, it is can be proved that the ideal value of average absolute difference is two-third of their mean value, which in this case is 85.333.

We can see from Table 5 that all the average absolute differences in the four cases are very close to the ideal value 85.333, which means that the proposed PRNG has high resistance against differential attack.

6.5 Efficiency analysis

In addition to security, the running speed becomes an important factor for practical applications. In the proposed PRNG, PLM is the core component. When iterating the PLM, we firstly need to determine the subinterval which the state value is in, then, calculate the next state value of the PLM. Since determining the subinterval of the state value is not a time-consuming operation, the computation of iterating the PLM is similar to that of iterating logistic map. As we know, the logistic map is usually used in chaos-based cipher for its high efficiency and good cryptographic properties. Thus, like the logistic map, the PLM also possesses the merit of high efficiency.

In the proposed scheme, the 8-bit number is generated by each iteration of the PLM. There are five addition/subtraction operations and seven multiplication/division operations in each iteration of the PLM. Besides the iteration of PLM, substitution and XOR are the other two main operations in the process of generating 8-bit pseudorandom number. The basic operations of generating 8-bit pseudorandom number are listed in Table 6. It is clear that the proposed scheme needs only 18 simple computation operations to output each 8-bit number, which guarantees its high efficiency.

6.6 Comparison analysis

Recently, some pseudorandom number generators based on chaotic maps have been presented [8, 1618, 24]. Owing to make full use of cryptographic property of chaotic system, all of these algorithms have ideal statistical performance and satisfies the requirement of resisting statistical attacks. Due to some homophyly between the proposed algorithm and them, the efficiency of our algorithm is compared with these of algorithms in Refs. [8, 24]. In Ref. [8], the PRNG is based on logistic map. After each iteration, only one bit is generated. To get an 8-bit pseudorandom number, the logistic map must be iterated for eight times. The numbers of performing each basic operation to obtain an 8-bit number is counted and also listed in Table 6. Three algorithms of generating pseudorandom numbers are presented based on spatiotemporal chaos in Ref. [24]. In the spatiotemporal chaos, the local chaotic maps are first iterated. Then, the new state values are calculated according to the coupling relationship between the local chaotic maps. Although the spatiotemporal chaos has more complex dynamic behavior, iterating the spatiotemporal chaos requires much more computational effort than iterating a simple chaotic map. Similarly, the numbers of each basic operation used to generating an 8-bit number is calculated and shown in Table 6. It is clear that the total number of basic operation in our scheme is smaller than those of the algorithms in Refs. [8, 24], which means that the proposed scheme has higher efficiency.

Table 7 The running speed of generating pseudorandom numbers

To further verify the efficiency results, our scheme and other algorithms in Refs. [8, 24] are implemented by using Visual C++ 6.0 and run on a computer with 330GH Intel Core i3-2120 CPU and 4G RAM. The running speeds of these algorithms are listed in Table 7. The results confirm that the proposed scheme not only owns higher efficiency but also satisfies the requirement of practical application.

7 Conclusion

In this paper, the piecewise logistic map (PLM) is proposed, which enhances some properties related to cryptography. The PLM has better ergodicity property and greater Lyapunov exponent than the logistic map, and extends the value range of \(\mu \) corresponding to chaotic status. In order to achieve more uniform density probability, we suggested that the variable control parameter should be employed when iterating the PLM. A PRNG is proposed based on PLM with \(N = 64\). The operations, such as substitution and XOR, are used in the process of generating numbers, which not only lower the correlation of two adjacent chaotic state values but also enhance the security of pseudorandom number sequence. The generated sequences based on our scheme are rigorously tested by the NIST suite. The tests results show that the proposed PRNG has perfect statistics performance. Moreover, the security and efficiency analyses have confirmed that the proposed algorithm satisfy all the performance requirements of a PRNG. It is practical and reliable, with high potential to be adopted in the design of stream cipher.