1 Introduction

Due to the impact of COVID-19, to reduce the risk of infection caused by conversation contact, people are accustomed to using the wireless network for communication from chats to high-secret video conferences. Therefore, how to ensure the security of data exchange in the network environment is a very important issue. In traditional encryption algorithms, such as RSA, AES, ECC, etc., they all rely on the complexity of static keys and encryption algorithms to strengthen the confusion of cipher-text to protect private information [1]. In such a symmetric encryption method, a static key is used. However, when the static key is cracked, information will be fully exposed. Furthermore, due to the ultra-high computing speed of IBM's quantum computer with 53 qubits, the time required for brute-force attack is greatly reduced. This has become a major concern of secure communication in the near future [2]. On the other hand, a chaotic system can generate a large number of random signals in a very short period, and these random signals are dynamic and unpredictable. These chaos-based dynamic random keys, combined with traditional symmetric encryption, will make it difficult to crack. In addition, the chaos-based cryptosystem has not the problem of key storage, because the random keys are dynamically generated and updated by the chaotic systems. A chaotic system is a non-periodic dynamical system with random state responses. The state responses have the characteristics of nonlinear, unpredictable trajectory, sensitivity to initial values, butterfly effect and strange attractors. The concept of hyper-chaotic systems was first proposed by Rössler in 1979 [3]. Hyper-chaotic systems have multiple strange attractors with positive Lapunov exponents. The unpredictable property is useful for secure communication and the application of communication security has attracted many researchers to invest in the literature [4, 5]. Among the reports [4, 5] on the encryption application, the design of a random number generator is very important. Generally speaking, random number generators have two types, namely true random number generators (TRNGs) and pseudo-random number generators (PRNGs) [6, 7]. True random numbers are unpredictable signals that usually exist in nature, such as electromagnetic noise and thermal noise. However, to extract true random numbers from the natural environment, additional sensing circuits must be used to obtain and convert signals, which is inconvenient and high in cost. Therefore, to reduce the cost, different artificial methods are proposed to generate pseudo-random numbers with the random property as the TRN as possible [8,9,10]. However, due to the difficulty of modeling, the real random number is very difficult to achieve synchronization control and apply to communication security. On the contrary, with the deterministic mathematical model of chaotic systems, it becomes possible to apply the chaos-based random numbers to the design of cryptosystems through synchronization controller design. In 1990, OGY (Ott, Grebogi and Yorke) [11] proposed the related research on controlling chaos. Then, Pecora and Carroll [12] tried to synchronize two chaotic systems with different initial values to have the same random state responses. Since then, there have been many studies focusing on the synchronization of chaotic systems [13, 14] and various control methods had been introduced for synchronization, such as sliding mode control [15, 16], optimal control [17], adaptive control [18], discrete sliding mode control [19] and fuzzy control [20], etc. The synchronization control can be utilized to generate the synchronized dynamic keys and then further design a high secure cryptosystem to guarantee communication security.

Motivated by the aforesaid, this study aims to develop a novel chaos-based cryptosystem to ensure the communication security of video/audio streaming in the network environment. To obtain high-quality random numbers, we use the generalized 4-dimensional Lorenz-Stenflo (4D LS) hyper-chaotic system to design the random number generator. The generalized 4D LS hyper-chaotic system is an advanced system based on the 3-dimensional continuous Lorenz system, which can dynamically generate four unpredictable random numbers [21, 22]. We firstly discretize the 4D LS hyper-chaotic system as a discrete model [23] such that it becomes easy to implement with microcontroller, and then design a discrete synchronization controller such that we can synchronize the master and slave chaotic systems to obtain the same random numbers simultaneously at both transmitter and receiver. It is worth mentioning that, in our design, the chaotic states and control signals are not necessary to fully expose in the public channel, so the security of the system can be promoted. After obtaining the synchronized chaotic random numbers, to promote the randomness quality of random numbers, we further integrate with the SHA3-256 algorithm [24] to complete the design of synchronized dynamic key generators (SDKGs) with a fixed length of 256 bits, which can be used for communication encryption. With the proposed SDKGs, we can complete the design of the dynamic cryptosystem for video/audio streaming. In this dynamic cryptosystem, audio/video signals are captured from the local microphone and camera, and then the proposed SDKGs are used to replace the static key of the traditional symmetric encryption algorithm AES CFB [25], to dynamically encrypt the data, and then send the ciphertext through the public channel. When the receiver receives the ciphertext, it will use the synchronized dynamic random keys of SDKGs with the AES CFB to decrypt the ciphertext, and finally recover the original audio/video data. The statistical analysis, histogram, connected component analysis [26, 27], information entropy [28], keyspace analysis and correlation indexes were calculated and analyzed through simulation experiments and comparisons to highlight the capability and feasibility of this design method.

This paper is organized as follows. Section 2 formulates chaos synchronization of 4D LS systems and the SDKGs implementation in the network environment. The chaos-based cryptosystem with SDKGs is realized in Sect. 3. Section 4 evaluates the security of the proposed chaos-based random key generator and chaos-based cryptosystem. Finally, we give brief conclusions in Sect. 5.

2 Synchronization of master–slave 4D LS hyper-chaotic systems and design of SDKGs

In this research, the design of a dynamic random key generator and its synchronization control are important core technologies. Therefore, we first discuss the synchronization controller design and implementation of the master–slave chaotic systems. Simultaneously, to facilitate the low-cost realization with digital microcontrollers, discrete chaotic systems will be considered. In the following, we will introduce the 4D LS hyper-chaotic system to discuss, of course, the technology developed in this paper can be extended and applied to different chaotic systems. The state equation of the generalized 4D LS system can be described as follows:

$$\begin{gathered} \dot{x}_{1} (t) = - ax_{1} (t) + ax_{2} (t) + \lambda x_{3} (t) \hfill \\ \dot{x}_{2} (t) = dx_{1} (t) + \gamma x_{2} (t) - x_{1} (t)x_{4} (t), \hfill \\ \dot{x}_{3} (t) = - cx_{1} (t) - x_{3} (t) \hfill \\ \dot{x}_{4} (t) = x_{1} (t)x_{2} (t) - bx_{4} (t) \hfill \\ \end{gathered}$$
(1)

where \(a, b, c, d,\gamma\) and \(\lambda\) are parameters of the system (1). \(x_{1} , x_{2} , x_{3}\) and \(x_{4}\) are the state variables. To facilitate the realization with the digital devices or components, we discretize the continuous system to obtain a corresponding discrete system. The following describes the method of system discretization. For a continuous-time chaotic system described by

$$\dot{x}\left( t \right) = Ax\left( t \right) + Bg\left( {x\left( t \right),t} \right),$$
(2)

where \(x\left( t \right) \in R^{n}\) is the state vector;\(g\left( {x\left( t \right),t} \right) \in R^{r}\) is the nonlinear function of systems. Matrices \(A\) and \(B\) are controllable. Then the discrete system corresponding to the system (2) can be obtained by

$$x_{d} \left( {k + 1} \right)T = Gx_{d} \left( {kT} \right) + Hg\left( {x_{d} \left( {kT} \right)} \right),$$
(3)

where \(G = e^{AT}\) and \(H = \left[ {G - I_{n} } \right]A^{ - 1} B\)[23], T is the sampling time. Obviously the 4D LS hyperchaotic system (1) can be rearranged as

$$\dot{x}\left( t \right) = \left[ {\begin{array}{*{20}c} {\dot{x}_{1} \left( t \right)} \\ {\dot{x}_{2} \left( t \right)} \\ {\dot{x}_{3} \left( t \right)} \\ {\dot{x}_{4} \left( t \right)} \\ \end{array} } \right] = Ax\left( t \right) + B\left[ {\begin{array}{*{20}c} { - x_{1} \left( t \right)} & {x_{4} \left( t \right)} \\ {x_{1} \left( t \right)} & {x_{2} \left( t \right)} \\ \end{array} } \right],$$
(4)

where \(x\left( t \right) \in R^{{4}}\) and \(x\left( t \right) = \left[ {\begin{array}{*{20}c} {x_{1} \left( t \right)} & {x_{2} \left( t \right)} & {x_{3} \left( t \right)} & {x_{4} \left( t \right)} \\ \end{array} } \right]^{T}\), \(A \in R^{{{4} \times {4}}}\) and \(B \in R^{{{4} \times {2}}}\) are obtained as

$$A = \left[ {\begin{array}{*{20}c} { - a} & a & \lambda & 0 \\ d & \gamma & 0 & 0 \\ { - c} & 0 & { - 1} & 0 \\ 0 & 0 & 0 & { - b} \\ \end{array} } \right],B = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} 0 \\ 1 \\ 0 \\ 0 \\ \end{array} } & {\begin{array}{*{20}c} 0 \\ 0 \\ 0 \\ 1 \\ \end{array} } \\ \end{array} } \right],$$
(5)

According to [23], the continuous-time 4D LS hyper-chaotic system (1) can be discretized as:

$$x_{d} \left( {k + {1}} \right) = Gx_{d} \left( k \right) + H\left[ {\begin{array}{*{20}c} { - x_{d1} \left( k \right)} & {x_{d4} \left( k \right)} \\ {x_{d1} \left( k \right)} & {x_{d2} \left( k \right)} \\ \end{array} } \right],$$
(6)

where \(G \in R^{4 \times 4}\) and \(H \in R^{4 \times 2}\) can be calculated by \(G = e^{AT}\) and \(H = \left[ {G - I_{n} } \right]A^{ - 1} B\). \(x_{d} \left( k \right) = \left[ {\begin{array}{*{20}c} {x_{d1} \left( k \right)} & {x_{d2} \left( k \right)} & {x_{d3} \left( k \right)} & {x_{d4} \left( k \right)} \\ \end{array} } \right]^{T}\) is the state vector of the discrete system (6).

Now we utilize the discretized 4D LS system (6) to design the 4D LS RNGs which can be synchronized by the synchronization controller. First, master and slave 4D LS systems are given, respectively, as (6) and (7).

$$y_{d} \left( {k + {1}} \right) = Gy_{d} \left( k \right) + H\left[ {\begin{array}{*{20}c} { - y_{d1} \left( k \right)y_{d4} \left( k \right)} \\ {y_{d1} \left( k \right)y_{d2} \left( k \right)} \\ \end{array} } \right] + H\left[ {\begin{array}{*{20}c} {u_{{1}} \left( k \right)} \\ {u_{{2}} \left( k \right)} \\ \end{array} } \right],$$
(7)

where \(x_{d} \left( k \right) = \left[ {\begin{array}{*{20}c} {x_{d1} \left( k \right)} & {x_{d2} \left( k \right)} & {x_{d3} \left( k \right)} & {x_{d4} \left( k \right)} \\ \end{array} } \right]^{T}\) is the state vector of master system (7) embedded in the transmitter; \(y_{d} \left( k \right) = \left[ {\begin{array}{*{20}c} {y_{d1} \left( k \right)} & {y_{d2} \left( k \right)} & {y_{d3} \left( k \right)} & {y_{d4} \left( k \right)} \\ \end{array} } \right]^{T}\) is the state vector of slave system (8) embedded in the receiver; \(u_{1} \left( k \right)\) and \(u_{2} \left( k \right)\) are the control inputs designed later to ensure synchronization (i.e. \(x_{d} \left( k \right) = y_{d} \left( k \right)\)) between master and slave systems. By using matrices in (5) with parameters \(a = 11.0, b = 2.9, c = 5, d = 23,\gamma = - 1,\lambda = 1.9\), sampling time\(T=0.001\), and the formulas of \(G = {\text{e}}^{AT}\) and \(H = \left[ {G - I_{n} } \right]A^{ - 1} B\) [23], matrices \(G\) and \(H\) can be calculated as

$$G = \left[ {\begin{array}{*{20}c} {{0}{\text{.9892}}} & {{0}{\text{.0109}}} & {{0}{\text{.0019}}} & {{0}{\text{.0000}}} \\ {{0}{\text{.0229}}} & {{0}{\text{.9991}}} & {{0}{\text{.0000}}} & {{0}{\text{.0000}}} \\ { - {0}{\text{.0050}}} & {{0}{\text{.0000}}} & {{0}{\text{.9990}}} & {{0}{\text{.0000}}} \\ {{0}{\text{.0000}}} & {{0}{\text{.0000}}} & {{0}{\text{.0000}}} & {{0}{\text{.9971}}} \\ \end{array} } \right],H = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {{0}{\text{.0000}}} \\ {{0}{\text{.0010}}} \\ {{0}{\text{.0000}}} \\ {{0}{\text{.0000}}} \\ \end{array} } & {\begin{array}{*{20}c} {{0}{\text{.0000}}} \\ {{0}{\text{.0000}}} \\ {{0}{\text{.0000}}} \\ {{0}{\text{.0010}}} \\ \end{array} } \\ \end{array} } \right]$$
(8)

Obviously, the matrix pair \(\left( {G,H} \right)\) is controllable. Then we define the error state as

$$e_{di} = y_{di} - x_{di} ,$$
(9)

where \(i = {1},2,3,4\), Then from (6), (7), (9), we have the error dynamics as

$$\begin{gathered} e_{d} \left( {k + {1}} \right) = Ge_{d} \left( k \right) \\ + H\left( {\left[ {\begin{array}{*{20}c} {x_{d1} \left( k \right)x_{d4} \left( k \right) - y_{d1} \left( k \right)y_{d4} \left( k \right)} \\ { - x_{d1} \left( k \right)x_{d2} \left( k \right) + y_{d1} \left( k \right)y_{d2} \left( k \right)} \\ \end{array} } \right] + \left[ {\begin{array}{*{20}c} {u_{1} \left( k \right)} \\ {u_{2} \left( k \right)} \\ \end{array} } \right]} \right), \\ \end{gathered}$$
(10)

where \(e_{d} \left( k \right) = \left[ {\begin{array}{*{20}c} {e_{d1} \left( k \right)} & {e_{d2} \left( k \right)} & {e_{d3} \left( k \right)} & {e_{d4} \left( k \right)} \\ \end{array} } \right]^{T}\)

The control input in the slave system (8) is designed as

$$\left[ {\begin{array}{*{20}c} {u_{{1}} \left( k \right)} \\ {u_{{2}} \left( k \right)} \\ \end{array} } \right] = u_{c} \left( k \right) - \left[ {\begin{array}{*{20}c} {x_{d1} \left( k \right)x_{d4} \left( k \right) - y_{d1} \left( k \right)y_{d4} \left( k \right)} \\ { - x_{d1} \left( k \right)x_{d2} \left( k \right) + y_{d1} \left( k \right)y_{d2} \left( k \right)} \\ \end{array} } \right],$$
(11)

where \(u_{c} \left( k \right) = - Ke_{d} \left( k \right)\), \(K \in R^{2 \times 4}\) is the designed gain matrix.

Substituting (11) into (10), we have

$$e_{d} \left( {k + {1}} \right) = \left( {G - HK} \right)e_{d} \left( k \right).$$
(12)

Since \(\left( {G,H} \right)\) is controllable, we can arbitrarily assign the eigenvalues of the matrix \(\left( {G - HK} \right)\). Thus, we can apply the pole assignment technology to design the matrix \(K\) such that \(\left| {{\text{Re}} \lambda_{i} \left( {G - HK} \right)} \right| < 1,i = 1,2,3,4\) and the error dynamics (12) is asymptotically stable. Obviously, from (12), the convergence speed of \(e_{d} \left( k \right)\) can be assigned and predicted with the eigenvalues of matrix \(\left( {G - HK} \right)\).

From the above discussion, it reveals that the controller (11) can asymptotically synchronize the master and slave chaotic systems. However, in the realization of the controller, to avoid the control information being exposed in the network environment, we disassemble the controller (11) into two parts, which are calculated separately at the transmitter and receiver, and then the complete control input signal is assembled at the receiver to achieve synchronization. The design is given as follows

$$\left[ {\begin{array}{*{20}c} {u_{1} \left( k \right)} \\ {u_{2} \left( k \right)} \\ \end{array} } \right] = \overbrace {{Kx_{d} \left( k \right) + \left[ {\begin{array}{*{20}c} { - x_{d1} \left( k \right)} & {x_{d4} \left( k \right)} \\ {x_{d1} \left( k \right)} & {x_{d2} \left( k \right)} \\ \end{array} } \right]}}^{{u_{m} \left( k \right)}} - \overbrace {{Ky_{d} \left( k \right) + \left[ {\begin{array}{*{20}c} {y_{d1} \left( k \right)} & {y_{d4} \left( k \right)} \\ { - y_{d1} \left( k \right)} & {y_{d2} \left( k \right)} \\ \end{array} } \right]}}^{{u_{s} \left( k \right)}},$$
(13)

where \(u_{m} \left( k \right) = \left[ {\begin{array}{*{20}c} {u_{m1} } & {u_{m2} } \\ \end{array} } \right]^{T}\) and \(u_{s} \left( k \right) = \left[ {\begin{array}{*{20}c} {u_{s1} } & {u_{s2} } \\ \end{array} } \right]^{T}\) are calculated, respectively, at the transmitter and receiver. In the following, we utilize the simulation tool of MATLAB to verify the control design discussed above. In this simulation, we first assign the eigenvalues of \(\lambda \left( {G - HK} \right) = \left[ {\begin{array}{*{20}c} {0.1} & { - 0.1} & {0.08} & {0.09} \\ \end{array} } \right]^{T}\) and the corresponding gain matrix K can be easily obtained using the pole assignment method with the command of ‘Place’ in the Matlab toolbox.

$$K = \left[ {\begin{array}{*{20}c} {0.0216} & {0.0003} & { - 1.6817} & 0 \\ 0 & 0 & 0 & {0.0001} \\ \end{array} } \right] \times 10^{7}$$
(14)

In this simulation, the initial conditions were selected as \(x_{d1} = - {1}.0\), \(x_{d2} = - {3}.0\), \(x_{d3} = {2}.0\), \(x_{d4} = - {5}.0\), \(y_{d1} = - {1}{\text{.1}}\), \(y_{d2} = - {3}.0\), \(y_{d3} = {2}.0\) and \(y_{d4} = - {4}.0\). Figures 1, 2, 3, 4, 5 show the simulation results. Figure 1 shows the strange attractor of the discrete version corresponding to the continuous 4D LS hyper-chaotic system in the transmitter. It confirms that the continuous hyper-chaotic system can be simulated by the corresponding discrete version. Figure 2 shows the state responses of the slave system in the receiver. Figure 2 also shows that the state of the hyper-chaotic system is random and cannot be predicted. Figure 3 shows the synchronization error between the master and slave systems. Figures 4 and 5 show, respectively, the control inputs and the state responses of master–slave hyper-chaotic systems. We can see that the synchronization errors converge to zero due to the control input. It means that we can obtain the same chaotic random number simultaneously at both transmitter and receiver.

Fig. 1
figure 1

Strange attractor of the discrete 4D LS hyper-chaotic system

Fig. 2
figure 2

State responses of the slave discrete 4D LS hyper-chaotic system

Fig. 3
figure 3

The time responses of synchronization errors

Fig. 4
figure 4

The time responses of control inputs

Fig. 5
figure 5

State responses of the master–slave discrete 4D LS systems

After verifying the synchronization, the design of chaos-based SDKGs is shown in Fig. 6.

Fig. 6
figure 6

The structure of SDKGs

In Fig. 6, \(u_{{{\text{m1}}}} \left( k \right)\) and \(u_{{{\text{m2}}}} \left( k \right)\) are firstly calculated at the transmitter (Master systems) and transmitted to the receiver through the public channel. At the same time, \(u_{{{\text{s1}}}} \left( k \right)\) and \(u_{s2} \left( k \right)\) are also obtained at the receiver (Slave systems). And then the receiver integrates the received \(u_{{{\text{m1}}}} \left( k \right)\) and \(u_{{{\text{m2}}}} \left( k \right)\) with the local signals \(u_{{{\text{s1}}}} \left( k \right)\) and \(u_{s2} \left( k \right)\) to obtain the synchronization controller in (14) and achieve synchronization of master and slave chaotic systems embedded in the transmitter and receiver, respectively. Finally, the synchronized chaotic random numbers are inputted to the SHA3-256 algorithm to generate synchronized random number sequence with a fixed length of 256 bits, respectively, at the transmitter and receiver. Such SDKGs will be applied for data encryption applications.

3 Cryptosystems for video/audio streaming via SDKGs

In the previous discussion, due to the synchronization controller, the master and slave hyper-chaotic systems at the transmitter and receiver can be synchronized. Then, through the avalanche effect of the SHA3-256 algorithm, a SDKG can be established. After obtaining the synchronized dynamic keys, we can apply them to the communication security of video/audio streaming data. The structure of the cryptosystem is shown in Fig. 7, which includes Lorenz-Stenflo SDKGs and encryption/decryption mechanisms. After the hyper-chaotic system of User A is synchronized with that of user B, both users can send the data of captured images and sounds to the encryption/decryption mechanisms. The modified AES CFB algorithm with synchronized dynamic keys is used for encryption /decryption calculations, and then the ciphertext is sent to the receiver through the network for decryption and finally the original plaintexts of streaming video/audio are obtained at the receiver. The images are pre-converted to JPEG format to reduce the load of network transmission.

Fig. 7
figure 7

The structure of cryptosystem

The realization of the system is shown in Fig. 8. We use the Raspberry Pi and the computer as the platforms for User A and User B, respectively. Then use the network camera to capture audio and video, as shown in Fig. 7, and transmit the real-time video and audio of both users through the TCP (Transmission Control Protocol) protocol with the Internet channel. The data is encrypted/decrypted through the synchronous dynamic keys and the AES CFB algorithm designed in this paper to achieve real-time video/audio data secure transmission.

Fig. 8
figure 8

The realization of the cryptosystem for video/audio streaming

In this cryptosystem as shown in Fig. 8, we further design a user interface. Users can build or join the streaming video conference room with their name and password as shown in Figs. 9 and 10, respectively. After confirming, users enter the window of the meeting room as shown in Fig. 11. The left image is the other user's image, and the upper right image is the user’s image. The bottom right is a list of all the users in this meeting room. Users can click ‘Leave’ in the upper left option to leave this meeting room. In addition, we also design the developer window to observe the system information. As shown in Figs. 12, 13, 14, 15, the dynamic keys, encrypted video, original audio signal and encrypted audio signal are displayed, respectively. The latest five dynamic random keys generated by SDKGs are shown in Fig. 12, and we can click ‘Pause’ or ‘Continue’ to update the dynamic key display; Fig. 13 shows the received encrypted image on the receiver, and it can be found that we cannot extract any information about original video image; the upper figure in Fig. 14 shows the received original audio data and the lower figure shows the Fourier spectrum of the audio data; the upper in Fig. 15 shows the un-decrypted audio signal, and the lower shows the Fourier spectrum of the un-decrypted sound signal, it can be observed that if it has not been decrypted, the sound is chaotic, and the Fourier spectrum is broad. Finally, in Figs. 16 and 17, we can have the actual video windows of the encryption/decryption in this system. The above results demonstrate that the proposed system with a synchronized 4D LS dynamic key generator can successfully perform dynamic encryption/decryption for video/audio stream data.

Fig. 9
figure 9

Creating a meeting room

Fig. 10
figure 10

Joining a meeting room

Fig. 11
figure 11

Window of the meeting room

Fig. 12
figure 12

Random dynamic keys

Fig. 13
figure 13

Encrypted image

Fig. 14
figure 14

The original audio signal

Fig. 15
figure 15

The encrypted audio signal

Fig. 16
figure 16

Window of user A

Fig. 17
figure 17

Window of user B

4 Security analysis of SDKGs and chaos-based cryptosystem

This article integrates synchronized master–slave hyper-chaotic systems with the SHA3-256 algorithm to generate dynamic random keys. Then the dynamic keys are combined with the AES CFB encryption algorithm to complete the cryptosystem for the real-time video/audio stream. To ensure the security of this encryption technology, the statistical analysis, histogram, connected component analysis(CCA), information entropy (IE), and key spaces are calculated in the following. To test the randomness quality of the encrypted streaming video, a 512 × 512 picture is prepared as shown in Fig. 18a. In actual application, to reduce the network transmission, the image will be converted from the pixel array to the JPEG format. After the format conversion, the file size is reduced from 786,432 bytes to 54,236 bytes. It can reduce the processing time for encryption/decryption. Then the JPEG file is encrypted by AES CFB with dynamic keys. The results are shown in Fig. 18b, c with one static key and five dynamic keys, respectively. It can be found that the encrypted images have no obvious features, and finally, it is decrypted and converted back to a pixel array as shown in Fig. 18d. Furthermore, to test the security of the actual video streaming, we continuously capture 12 pictures as shown in Fig. 19 from the video streaming. Figures 19a and b are the first and last captured pictures, respectively. All pictures are with a size of 819,234 Bytes. Also, a pre-recorded audio file with the size of 819,234 Bytes is used to test the randomness.

Fig. 18
figure 18

Picture files (a) original image (b) encrypted image by one key (c) encrypted image by five keys (d) decrypted image

Fig. 19
figure 19

Real-time 12 images captured (a) The first one captured; b The last one captured

4.1 NIST analysis

In this section, we introduce the National Institute of Standards and Technology (NIST) test suite [8] to evaluate the randomness of the dynamic random keys and encrypted data. This evaluation standard contains 15 items and the test result for every test item is called the p value. When the p value > 0.01, it means that the test item has passed. With a larger p value, it means the better randomness of the test data. We select the dynamic keys generated with the state \({x}_{d1}\) of the chaotic system. The test results in Table 1 were obtained with a stream length of 6,553,872 bits and a bitstream count of 30. The captured pictures in Fig. 19 and pre-recorded sound file are encrypted with AES CFB and five dynamic keys. Obviously, all the test results shown in Table 1 pass the tests. The performance results of the traditional AES CFB only using a static key are shown in Table 2. According to the results in Tables 1 and 2, it shows that under the same conditions, the test results of the sound file and images using the dynamic keys are about 1.25 and 1.91 times, respectively, better than those with the static key. Furthermore, in Table 3, we compare the test results in this paper with those of other random number generators proposed in [29, 30]. The average score is as high as 7.31865, which is much higher than those obtained in [29, 30].

Table 1 NIST SP 800-22 test results of dynamic random keys and pre-recorded file
Table 2 NIST SP 800-22 test results of encrypted images and audio file with a static key
Table 3 NIST SP 800–22 test results in [29, 30]

4.2 Histogram analysis

For an image, the histogram is an important statistical feature. A good cryptosystem can encrypt an image and the histogram of the cipher image is evenly distributed such that attackers could not analyze statistical features of the original image from its cipher image. Each pixel in the picture is between 0 and 255. Use the image as shown in Fig. 18a for the test. First, the histogram analysis for the grayscale image of the original image is shown in Fig. 20a. Figure 20b shows the histogram analysis for the image in JPEG format. It is observed that both Figs. 20a and b have obvious differences in some specific pixel values. The histogram of the cipher image by one static key and five dynamics keys are shown in Figs. 20c and d. From Figs. 20c and d, it demonstrates that the encryption could effectively eliminate the differences between the histogram information.

Fig. 20
figure 20

Histogram analysis (a) the original image(b) the original image with JPEG format (c) the cipher image by one key (static key) (d) the cipher image by five dynamic keys

To evaluate the uniform distribution of histograms, we calculate the variance of histogram [31] defined by

$$V\left( X \right) = \frac{{1}}{{{256}^{{2}} }}\sum\limits_{i = 0}^{255} {\sum\limits_{j = 0}^{255} {\frac{1}{2}\left( {x_{i} - x_{j} } \right)^{2} } } ,$$
(15)

where\(X=\left\{{x}_{0},{x}_{1},\cdots ,{x}_{255}\right\}\), and \(x_{i}\), \(x_{j}\) are the number of pixel values i, j, respectively.

Table 4 shows the variance of histograms in (15). The variance of the original image in Fig. 20a is extremely large, and it is reduced to 17,383 after being converted into JPEG format. When the traditional fixed key (static key) is used for the AES CFB encryption algorithm, it can be found that the variance is reduced to 232. However, with our encryption approach, the variance has been reduced to 202. The comparisons show that the proposed encryption method is effective to reduce the deviation of the picture and make it difficult to identify any features of the picture. Under the same conditions, compared with other proposed papers [32], we can find that our proposed encryption effect is very effective.

Table 4 The variance of histogram

4.3 Connected component analysis(CCA)

Generally, for a plain image, there always exists a high correlation between adjacent pixels. Therefore, good encryption algorithms can result in smaller correlation values between adjacent pixels. We randomly select 3000 pixels from the information of plaint and encrypted images of image 1 in Figs. 18a–c. The correlation coefficients for the horizontal, vertical, and diagonal directions were calculated by using the following equations [33]:

$$CCA = \frac{{\sum\nolimits_{i = 1}^{N} {\left( {x_{i} - \frac{1}{N}\sum\nolimits_{i = 1}^{N} {x_{i} } } \right)\left( {y_{i} - \frac{1}{N}\sum\nolimits_{i = 1}^{N} {y_{i} } } \right)} }}{{\sqrt {\sum\nolimits_{i = 1}^{N} {\left( {x_{i} - \frac{1}{N}\sum\nolimits_{i = 1}^{N} {x_{i} } } \right)^{2} \times \sum\limits_{i = 1}^{N} {\left( {y_{i} - \frac{1}{N}\sum\nolimits_{i = 1}^{N} {y_{i} } } \right)^{2} } } } }},$$
(16)

where, \(x_{i}\) and \(y_{i}\) denote the pixel values of the two adjacent pixels and N is the number of pair \((x_{i} ,y_{i} )\).

In Fig. 21, it can be seen that the original picture is highly correlated; while the picture converted to JPEG format has a more even distribution, but there are still clusters on the upper right. However, the encrypted images with one key and five keys, respectively, are distributed randomly and uniformly. Detailed reports of the connected component analysis are given in Tables 5 and 6. According to Tables 5 and 6, it could be seen that the encrypted image with the proposed five dynamic keys had the lowest pixel correlation which is superior to the results in the previous reports [32, 34, 35].

Fig. 21
figure 21

Connected component analysis (a) the original image (b) the original image with JPEG format (c) the cipher image by one key (static key) (d) the cipher image by five keys

Table 5 Connected component analysis (N = 3000)
Table 6 Connected component analysis (N = 10,000, 15,000)

4.4 Information entropy analysis

Information entropy is a measure of uncertainty. We can judge the randomness degree of an event by calculating the entropy value. For the encrypted image, a large entropy value implies a better encryption effect. The calculation method is given as follows [36]:

$$H = - \sum\limits_{i = 1}^{255} {p_{i} } \log_{{2}} p_{i}$$
(17)

where \({p}_{i}\) is the frequency of each greyscale For a grayscale image, the pixel has a data field of [0, 255] and the maximum value of IE will be 8. We use the pictures in Fig. 18a-c for analysis. The calculation results are shown in Table 7. The results indicate that the original image has the smallest entropy and the encrypted image is with the maximum value of 7.9911 by five keys which means that the encryption effect is good. Therefore, it could be concluded that the encrypted image possessed true random signal property and the proposed algorithm could resist entropy attacks.

Table 7 Information entropy analysis

4.5 Keyspace analysis

In this paper, we introduce the discrete 4D LS hyper-chaotic system with four initial state variables. Therefore, the keyspace is \({10}^{{{20}}}\) when the calculation accuracy is \({10}^{{ - 5}}\). Furthermore, Since the dynamic key generator is integrated with the SHA3-256 algorithm with keyspace \({2}^{{{256}}}\), the keyspace of dynamic keys generated with our method is \(S = {10}^{{{20}}} \times {2}^{{{256}}} = {1}{\text{.158}} \times {10}^{{{97}}}\) which is large enough to resist the brute-force attack.

4.6 NPCR and UACI analysis

NPCR (Number of pixels change rate) and UACI (Unified average changing intensity) are often used to analyze the sensitivity of a plain image so that differential attacks can be resisted [37]. The formulas are defined as follows:

$${\text{D}}\left( {i,j} \right) = \left\{ {\begin{array}{*{20}c} {0,if} \\ {1,if} \\ \end{array} } \right.\begin{array}{*{20}c} {C_{1} \left( {i,j} \right){ = }C_{2} \left( {i,j} \right)} \\ {C_{1} \left( {i,j} \right) \ne C_{2} \left( {i,j} \right)} \\ \end{array}$$
(18)
$$NPCR = \frac{1}{M \times N}\sum\limits_{i = 1}^{M} {\sum\limits_{j = 1}^{N} {D\left( {i,j} \right)} } \times 100\%$$
(19)
$$UACI = \frac{1}{M \times N}\sum\limits_{i = 1}^{M} {\sum\limits_{j = 1}^{N} {\frac{{\left| {C_{1} \left( {i,j} \right) - C_{2} \left( {i,j} \right)} \right|}}{255}} } \times 100\%$$
(20)

where M and N are the width and height of encrypted images. \(C_{1} \left( {i,j} \right)\) and \(C_{2} \left( {i,j} \right)\) are, respectively, the pixels with the location \(\left( {i,j} \right)\) of two ciphered images \(C_{1}\) and \(C_{2}\). To perform NPCR and UACI tests, we continuously captured 12 images as shown in Fig. 19. After converting to JPEG format, each image randomly selected a pixel to increase or decrease by 1 and the original images and the slightly changed images can be encrypted with 5 dynamic keys proposed in the paper for testing. The results are shown in Table 8. According to the test results in Table 8, the average NPCR test is 99.6138%, while the UACI is 33.4700%. Furthermore, a comparison of NPCR and UACI tests of the proposed method and the others is given in Table 9. The comparison results reveal that the method proposed in this paper has better results in NPCR and UACI tests.

Table 8 NPCR and UACI analysis of Real-time captured images
Table 9 Comparison of NPCR and UACI criteria of proposed method and the others

5 Conclusions

In this paper, a novel design of random number generators has been firstly proposed by integrating the chaos random property and the avalanche effect of SHA3-256. Then by the design of the synchronization controller of master–slave hyper-chaotic systems, the dynamic random keys can simultaneously be generated at both transmitter and receiver. Continuously, an improved AES CFB encryption algorithm with dynamic random keys is realized to encrypt /decrypt streaming audio/video data. In addition, several tests and analyses, such as visual effect, statistical analysis, histogram, information entropy analysis, keyspace analysis were all performed to show the capability and security of the improved chaos-based AES CFB algorithm.