# Wireless Sensor Network Security Based on Improved Identity Encryption

Authors: Hao Zhou; Haochang Bi
Journal: Scientific Programming
 (2022)

---

## Abstract

In order to protect network information security and improve the security of wireless sensor networks, based on chaotic systems, we propose a wireless sensor algorithm based on improved identity encryption. First, the basic principle of chaotic system mapping is specifically analyzed; the two chaotic mapping systems are rectified to obtain the hybrid chaotic mapping system according to the demand of wireless sensing network. After that, an encryption framework and key are designed and the hybrid mapping system is applied to the encryption framework to encrypt the data. In this way, the length of the encryption algorithm is lengthened and the defensibility of the encrypted content is improved. Finally, the performance of the proposed encryption algorithm is tested in terms of information entropy, statistical methods, and ciphertext randomness. The test results show that compared with other encryption algorithms, the running speed of the encryption algorithm proposed in this paper is only 18.51 ms, which is faster than that of other encryption algorithms, and the memory consumption is only 27%, which is much lower than that of other algorithms. It can be seen that the proposed encryption algorithm has strong encryption effect and superior algorithm performance for data encryption in wireless sensor networks.


---

## Body

## 1. Introduction

With the continuous improvement of Internet technology, computers, cell phones, and many other computer devices are widely used and have become essential products for daily life, enhancing information exchange and enriching people’s entertainment. However, the widespread popularity and application of devices such as wireless sensors in computers have also brought about information security problems, and the security of people’s information on the network has been seriously threatened. Therefore, encryption technology was born. The current market research on wireless sensor network security mainly includes encryption algorithms and authentication schemes, which serve to guarantee data security and legitimacy. However, the complex node resources and small memory of wireless sensor networks lead to the low computational accuracy and poor results of the existing encryption algorithms for wireless sensor networks. Among them, chaotic system has the characteristics of sensitivity to initial value, ergodicity, pseudo-randomness, etc., which meets the characteristics of diffusion and obfuscation in encryption algorithms and achieves preliminary application results in information security. For network information encryption, scholars and experts have conducted in-depth research. Maram et al. proposed a dynamic S-box approach to process Unicode text data [1]. Ahmad et al. proposed to use the Diffie–Hellman technique to exchange the encryption key generated by TTI algorithm with another party as a way to improve the security of sensitive information transmission [2]. Liang et al. proposed a dynamic key encryption-decryption neural network chaotic algorithm, and the results showed that the encryption-decryption speed and anti-decryption ability of the method had a great improvement [3]. Chaotic encryption algorithm was widely used, for example, Deng and Xiao applied the chaotic algorithm to the encrypted transmission of RFID, and the results showed that the algorithm can meet the security requirements of object RFID [4]. Zhang et al. applied chaos algorithm to video transmission encryption to encrypt the differential components of motion vectors in horizontal and vertical directions as well as DC transform coefficients, respectively, and achieved good results [5]. Ge et al. proposed an encryption method for images based on cross-diffusion of logistic mapping and Chebyshev mapping by combining chaos algorithm. The results indicated that the encryption algorithm had high security [6]. Wu et al. proposed a chaotic compressed sensing algorithm for OFDM-PON networks, with results showing that the method can save bandwidth and improve the security of OFDM-PON networks [7]. The above studies show that chaotic algorithm is widely used in the field of data transmission [8–17]. Therefore, this study proposes an improved chaos-based encryption algorithm for wireless networks based on the characteristics of chaos algorithm and verifies the feasibility of the proposed algorithm.


## 2. Basic Methods

In the field of network information security, chaotic systems possess sensitivity, ergodicity, and unpredictability that have led to smaller applications in information security. Chaotic mappings are mainly divided into logistic mappings and cubic mappings.Logistic mapping is in one-dimensional form in chaotic systems and can be expressed as(1)xn+1=μxn1−xn,μ∈0,4,xn∈0,1,where μ is a parameter and when μ∈ (3.57, 4), the logistic mapping exhibits chaotic properties.The cubic mapping is calculated as(2)xn+1=axn3−bxn,xn∈−1,1,where both a and b are parameters, the output range of Cubic mapping is shown in Figure 1, and the mapping range becomes progressively smaller with increasing parameter a.Figure 1
Trend of the range of cubic mapping with parametera.As shown in Figure2, a bifurcation point will occur when the parameter b is higher than 2.3, and the chaotic system is in a chaotic state at this time. To obtain better pseudo-randomness, a is set to 4 and b is set to 3. The cubic mapping expression is obtained as follows:(3)xn+1=4xn3−3xn,xn∈−1,1.Figure 2
Trend of the range of cubic mapping with parameterb.In wireless sensor networks, chaotic systems cannot perform complex calculations on the network due to the problems of small network memory and poor computational power. To apply chaotic systems to wireless sensor network encryption, the chaotic system needs to be rectified.The logistic mapping can also be expressed as(4)xn+1=1−λxn2,λ∈0,2,xn∈−1,1,where λ is a parameter. The logistic mapping integerization in chaotic systems consists of three main steps, as follows:(1)
Multiply both sides of equation (4) by m2=m≠0 at the same time and obtain the following equation(5)m2xn+1=m2−λmxn2.(2)
Construct an equation:(6)zn=mxn+m.After a simple treatment of equation (6), equation (7) is calculated as follows:(7)xn=znm−1xn+1=zn+1m−1.(3)
Substitute equation (7) into equation (5) and set the parameter λ to 2. The final integer logistic mapping equation is obtained as(8)zn+1=4zn−2mzn2.In equation (6), xn interval is [−1, 1]; zn interval is [0, 2m]; if zn are integers, then m = 2L−1, thus obtaining the zn interval as [0,2L].Equation (8) contains two zeros, zn = 0 and zn = 2m. If the initial iteration value is 0 or 2m, the value of all subsequent iterations will be 0. To prevent the above situation, equation (8) will be optimized:(9)zn+1=4zn−2mzn2−1,zn=0or2mzn+1=4zn−2mzn2−1,others.There are no zeros in equation (9) so that all iteration values will not be 0.According to the cubic mapping of equation (3), it is integerized as follows:(1)
Construct the following equation:(10)xn=ync−1xn+1=yn+1c−1.(2)
Substitute equation (10) into equation (3) to obtain the following equation:(11)yn+1=4c2yn3−12cyn2+9yn.In equation (10), the xn interval is [−1,1], and the yn interval is obtained as [0, 2c]. If the yn values are all integers, then c = 2L−1, and the yn interval is [0, 2L].Equation (11) contains several zeros, yn = 0, yn = 1.5c, and yn = c. If the initial iteration value is 0, 1.5c, or c, then all subsequent iterations have a value of 0. Thus, equation (11) is optimized to obtain the following equation:(12)yn+1=4c2yn3−12cyn2+9yn+1,yn=0or32c4c2yn3−12cyn2+9yn,others.There are no zeros in equation (12), and the iterative value of 0 does not occur when iterating.


## 3. Improved Identity Encryption Algorithm

### 3.1. Cryptographic Framework

The chaotic algorithm after integer is computed by Feistel cryptographic framework as shown in Figure3, and the encryption process is as follows:(13)Ri+1Li⊕FKi,RiLi+1=Ri.Figure 3
Cryptographic framework.The Feistel structure belongs to a symmetric cryptographic framework in which the round functionF has an important impact on the performance of the algorithm. The main details of the round function F are shown in Figure 4.Figure 4
Round functionF.In Figure4, ⊕ is the XOR operation. The round function encryption process is divided into three main steps, as follows.(1)
First a 32-bit plaintext is divided into two parts of equal length, each side of length 16; then, a part is divided into two parts of equal length, of length 8.(2)
The two 8-bit plaintexts are followed by the number “0” to bring their length to 16 bits.(3)
The round key will be XOR operated on the 16-bit plaintext separately, followed by the logistic and cubic mappings, and then the XOR operation will be performed. Finally, the XOR value is passed through a 16-bit permutation matrix to obtain the output.The algorithm encrypts a total of 4 rounds, i.e.,r = 4.


### 3.2. Generation of Round Key

In the above, the performance of the two chaotic systems degrades gradually after the integerization, which leads to the reduction of their sequence randomness. Therefore, to solve the above problem, the two chaotic systems are mapped together to obtain one hybrid chaotic system.Also, this part generates the initial values of the hybrid chaotic system by a linear congruential generator. The linear congruential generator expression is given by [18, 19](14)yn+1=16807×ynmod231−1.With the addition of a linear congruential generator to the hybrid chaotic system, the period of the sequence generated by the hybrid chaotic system is extended to 231–1. The specific flow of generating chaotic sequences is shown in Figure 5.Figure 5
Generation of chaotic sequences.The autocorrelation of integer logistic mapping and integer cubic mapping in a 16-bit processor is shown in Figures6 and 7.Figure 6
Integer logistic mapping.Figure 7
Integer cubic mapping autocorrelation.From Figures6 and 7, it can be seen that the autocorrelation of logistic and cubic chaotic mappings is poor, which affects their encryption effect. Therefore, the study will use the quantization operation method to enhance the autocorrelation of the two chaotic systems. The autocorrelation of the sequences generated by the quantized hybrid chaotic system is shown in Figure 8, from which it can be found that the autocorrelation image is mainly in the form of impulse function, which indicates that the sequences generated by the quantized hybrid chaotic system have better autocorrelation and can achieve better encryption effect.Figure 8
Autocorrelation of chaotic sequences.An arbitrary 32-bit sequence is selected from the sequence generated by the hybrid chaotic system and divided into two parts of equal length, labeledk1 and k2, respectively [20, 21].As shown in Figure9, k1 and k2 are used as the initial values for generating the round key, the process of which is divided into three main steps, as follows.(1)
The initialization matrixM is generated by k1 and k2.(2)
Loop the value of matrixM twice and assign all of them to matrix N afterwards.(3)
Eight shift operations are performed on the matrix and the values in the matrix to obtain the eight round keys needed for encryption.Figure 9
The generation of round key.


### 3.3. Permutation Matrix

In cryptography, the permutation operation is a typical practice whose main function is to complicate the relationship between plaintext and ciphertext. In the chaotic encryption algorithm, the study will be represented by a permutation matrixP:(15)P=1071291151152623282527211731161331446823229193020222418.In the matrix, each parameter is the position of the input sequence. The parameter “10” means that when the input sequence passes through the permutation matrix, the parameter at the tenth position becomes the parameter at the first position of the output sequence. This can be expressed as follows:(16)1110000100110110P⟶0010001110110011.


### 3.4. Decryption

From the above cryptographic framework, it is clear that the Feistel structure is a symmetric state and the decryption and encryption steps are roughly the same. The difference lies in the order of using the round keys, such as the order in encryptionK1,K2,K3,K4; conversely, the decryption round key is the reverse of the encryption round key K4,K3,K2,K1. The decryption is calculated as in equation (15) [22–24]:(17)Li=Ri+1⊕FKi,Ri,Ri=Li+1.Meanwhile, the substitution inverse matrixP−1 can be expressed as(18)P−1=1116713101421541936812537322329263018312017251922242821.FromP−1 matrix, we can see that the element in the first position of the input sequence becomes the element in the eleventh position of the output sequence after permutation; if we want to restore the element in the eleventh position of the output sequence to the first position of the input sequence again through the permutation inverse matrix, we need to set the first value of the permutation inverse matrix to 11, and so on, to obtain the permutation inverse matrix.


## 3.1. Cryptographic Framework

The chaotic algorithm after integer is computed by Feistel cryptographic framework as shown in Figure3, and the encryption process is as follows:(13)Ri+1Li⊕FKi,RiLi+1=Ri.Figure 3
Cryptographic framework.The Feistel structure belongs to a symmetric cryptographic framework in which the round functionF has an important impact on the performance of the algorithm. The main details of the round function F are shown in Figure 4.Figure 4
Round functionF.In Figure4, ⊕ is the XOR operation. The round function encryption process is divided into three main steps, as follows.(1)
First a 32-bit plaintext is divided into two parts of equal length, each side of length 16; then, a part is divided into two parts of equal length, of length 8.(2)
The two 8-bit plaintexts are followed by the number “0” to bring their length to 16 bits.(3)
The round key will be XOR operated on the 16-bit plaintext separately, followed by the logistic and cubic mappings, and then the XOR operation will be performed. Finally, the XOR value is passed through a 16-bit permutation matrix to obtain the output.The algorithm encrypts a total of 4 rounds, i.e.,r = 4.


## 3.2. Generation of Round Key

In the above, the performance of the two chaotic systems degrades gradually after the integerization, which leads to the reduction of their sequence randomness. Therefore, to solve the above problem, the two chaotic systems are mapped together to obtain one hybrid chaotic system.Also, this part generates the initial values of the hybrid chaotic system by a linear congruential generator. The linear congruential generator expression is given by [18, 19](14)yn+1=16807×ynmod231−1.With the addition of a linear congruential generator to the hybrid chaotic system, the period of the sequence generated by the hybrid chaotic system is extended to 231–1. The specific flow of generating chaotic sequences is shown in Figure 5.Figure 5
Generation of chaotic sequences.The autocorrelation of integer logistic mapping and integer cubic mapping in a 16-bit processor is shown in Figures6 and 7.Figure 6
Integer logistic mapping.Figure 7
Integer cubic mapping autocorrelation.From Figures6 and 7, it can be seen that the autocorrelation of logistic and cubic chaotic mappings is poor, which affects their encryption effect. Therefore, the study will use the quantization operation method to enhance the autocorrelation of the two chaotic systems. The autocorrelation of the sequences generated by the quantized hybrid chaotic system is shown in Figure 8, from which it can be found that the autocorrelation image is mainly in the form of impulse function, which indicates that the sequences generated by the quantized hybrid chaotic system have better autocorrelation and can achieve better encryption effect.Figure 8
Autocorrelation of chaotic sequences.An arbitrary 32-bit sequence is selected from the sequence generated by the hybrid chaotic system and divided into two parts of equal length, labeledk1 and k2, respectively [20, 21].As shown in Figure9, k1 and k2 are used as the initial values for generating the round key, the process of which is divided into three main steps, as follows.(1)
The initialization matrixM is generated by k1 and k2.(2)
Loop the value of matrixM twice and assign all of them to matrix N afterwards.(3)
Eight shift operations are performed on the matrix and the values in the matrix to obtain the eight round keys needed for encryption.Figure 9
The generation of round key.


## 3.3. Permutation Matrix

In cryptography, the permutation operation is a typical practice whose main function is to complicate the relationship between plaintext and ciphertext. In the chaotic encryption algorithm, the study will be represented by a permutation matrixP:(15)P=1071291151152623282527211731161331446823229193020222418.In the matrix, each parameter is the position of the input sequence. The parameter “10” means that when the input sequence passes through the permutation matrix, the parameter at the tenth position becomes the parameter at the first position of the output sequence. This can be expressed as follows:(16)1110000100110110P⟶0010001110110011.


## 3.4. Decryption

From the above cryptographic framework, it is clear that the Feistel structure is a symmetric state and the decryption and encryption steps are roughly the same. The difference lies in the order of using the round keys, such as the order in encryptionK1,K2,K3,K4; conversely, the decryption round key is the reverse of the encryption round key K4,K3,K2,K1. The decryption is calculated as in equation (15) [22–24]:(17)Li=Ri+1⊕FKi,Ri,Ri=Li+1.Meanwhile, the substitution inverse matrixP−1 can be expressed as(18)P−1=1116713101421541936812537322329263018312017251922242821.FromP−1 matrix, we can see that the element in the first position of the input sequence becomes the element in the eleventh position of the output sequence after permutation; if we want to restore the element in the eleventh position of the output sequence to the first position of the input sequence again through the permutation inverse matrix, we need to set the first value of the permutation inverse matrix to 11, and so on, to obtain the permutation inverse matrix.


## 4. Experimental Results and Analysis

### 4.1. Experimental Environment

To verify the effectiveness of the proposed algorithm performance, this experiment will be implemented using C program and the algorithm will be applied to the ZigBee platform, which contains 128 KB of ROM, 4 KB of RAM, and a CC2530 microprocessor.


### 4.2. Algorithm Evaluation Index

#### 4.2.1. Information Entropy

In order to test the performance of hybrid chaotic systems, i.e., to test the system complexity and security, the experiment will use information entropy to verify the performance of chaotic systems. The higher the value of information entropy, the stronger the complexity of the system. That is, the information entropy can effectively measure the system. If the length of the ciphertext is 8 bits, the information entropy is taken to be about 8 for better encryption. The expression of information entropy is as follows [25]:(19)Hx=∑xPxlog21px.The entropy of various ciphertext information of different lengths is shown in Table1.Table 1
Ciphertext information entropy.
Ciphertext length (bytes)Information entropy160.0007.9642320.0007.9765480.0007.9835640.0007.9926800.0007.9999From Table1, we can visually see that the ciphertext length is extended from 16000 to 800000, and its information entropy is increased from 7.9642 to 7.9999, which is very close to the standard value of 8. This shows that the ciphertext has strong randomness and also proves that the system has better performance, complexity, and security and can effectively avoid external attacks on network information.


#### 4.2.2. Confusion and Diffusion

In encryption algorithms, confusion and diffusion are the two basic principles that must be followed. Confusion serves to complicate the relationship between the plaintext and the ciphertext, and diffusion, i.e., the maximum impact on the ciphertext through the plaintext, further enhances the security of the ciphertext.In order to verify the confusion and diffusion effect of the encryption algorithm and to evaluate and assess the performance of the encryption algorithm more objectively, the degree of completeness, degree of avalanche, and degree of strict avalanche are used as evaluation indexes in this experiment.If an encryption algorithm encrypts a plaintext ofn bits into a ciphertext of m bits, the performance of the encryption algorithm is measured using the above three criteria. Completeness represents the existence of correlation between each bit of the plaintext and all bits of the ciphertext species, and the completeness expression is as follows:(20)dc=−11nm#i,j|aij=0.The avalanche degree represents that each change of one bit in the plaintext will change at least nearly half of the bits of all ciphertexts, and the avalanche degree expression is as in equation (18):(21)da=1−2#X∗nm∑i=1n∑j=1mjbij−m2#X.The strict avalanche degree is the probability that for each bit changed in the plaintext, each bit in the ciphertext is changed at least 50%, which is expressed as follows [26–28]:(22)dsa=1−2#X∗nm∑i=1n∑j=1maij−12#X.In the above equation,aij denotes the i-th row and j-th column element inside the dependency matrix a containing n∗m elements, i takes values in the range (1, n), and j takes values in the range (1, m). If the i-th element of the plaintext is changed, the j-th element of the ciphertext changes; then aij = 1; otherwise aij = 0.bij denotes the i-th row and j + 1-th column element inside the distance matrix B containing n∗(m + 1) elements, i takes values in the range (0, n), and j takes values in the range(0, m). If the i-th element of the plaintext is changed, the plaintext is changed by j bits, and then bij = 1. The symbol X represents the total number of bits in the plaintext; # indicates the summation symbol.If the values ofdc, da, and dsa meet the criteria of equation (20), it means that the proposed algorithm possesses good results in confusion and diffusion.(23)dc=1,da≈1,dsa≈1.The trends of the above three evaluation indexes under different encryption rounds are shown in Figures10–12.Figure 10
Value ofdc for different number of encryption rounds.Figure 11
Value ofda. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)Figure 12
Value ofdsa. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)The change curves ofdc, da, and dsa indicators from Figures 10–12 show that when the number of encryption rounds is 4, da and dsa show stable trends with no significant change. The optimal number of encryption rounds can be determined to be 4, thus minimizing the resource loss of wireless sensors and ensuring the security of encrypted information.To further verify the superiority of the proposed encryption algorithm based on hybrid chaotic system, this experiment compares the designed algorithm with the traditional two encryption algorithms of RC5 and RC6 for wireless sensor network for confusion and diffusion, and the comparison results obtained are shown in Table2.Table 2
Performance comparison of the proposed encryption algorithm and traditional encryption algorithm.
AlgorithmdcdadsaRC5 [29]1.0000000.9997860.999770RC6 [29]1.0000000.9997790.999799The algorithm designed in this paper1.0000000.9998120.999772From the above table, thedc values of all three algorithms are 1, which indicates that the completeness of all three algorithms is good. da and dsa of the proposed algorithm are 0.998 and 0.999, respectively, which are both higher than those of the other two algorithms, by (0.005, 0.12) and (0.007, 0.009), respectively, compared to the RC5 and RC6 encryption algorithms. This shows that the proposed algorithm is more effective in confusion and diffusion, and the algorithm performs better than the traditional encryption algorithm.


### 4.3. Statistical Analysis

In order to verify the randomness of the ciphertext after performing the encryption algorithm, this experiment will perform a statistical analysis of the length of the ciphertext, with 0 and 1 as the criteria, and the number of ciphertexts is 0 or 1, indicating that they are roughly the same. The statistical analysis table is shown in Table3.Table 3
Statistical analysis of “0” and “1.”
Length of ciphertextnNumber of “0”k1Number of “1”k2k1/nK2/n1,280,000 bits631,923648.07749.369%50.631%2,560,000 bits1,282,4251,277,57550.095%49.905%3,840,000 bits1,924.1631,915,83750.108%49.892%5,120,000 bits2,557,4392,562,56149.950%50.050%6,400,000 bits3,199,6713,200,32949.995%50.005%From the above table, it can be seen that after encryption by encryption algorithm, ciphertext of different lengths can be obtained. The number of “0” and “1” in the ciphertext is very close to each other and gets closer after increasing the length continuously, indicating that the ciphertext data achieve the 0-1 balance objective.In the plaintext, the ASCII distribution is uneven. After encryption, the ASCII distribution gradually tends to be homogeneous, which means that the encryption algorithm can effectively defend against probabilistic attacks. The ASCII distributions of both are shown in Figure13.Figure 13
ASCII distributions. (a) Plaintext. (b) Ciphertext.
(a)(b)As can be seen from the above graph, the plaintext ASCII distribution shows a large undulating peak at 50, 100, and 150, indicating a higher probability of aggressiveness and a lower defensibility in the plaintext, which makes it vulnerable to external intrusion and threats. After encrypting the plaintext, the ASCII code values shown in Figure13(b) are obtained. It can be seen that the probability of ASCII code values is all around 40%, which indicates that they are very evenly distributed and further proves that the encrypted ciphertext is more defensive and less likely to be attacked.


### 4.4. SP 800-22 Test

In order to test whether the ciphertext sequence is secure after using the encryption algorithm, this experiment is conducted to test 15 information security items of SP800-22. There are 1 million bytes in this ciphertext, and it is divided into 400 copies equally. The test results of this information are as follows. If all theP values in the table are more than 0.01, it indicates that the ciphertext sequence information meets the criteria.As can be seen from Table4, the P values of the ciphertext sequences are all above 0.01, with the lowest being 0.012351 and the highest being 0.943113. The experimental results show that all the above sequences meet the standard and satisfy the requirements of wireless sensor information security protection.Table 4
SP 800-22 test.
Statistical testP valueResultFrequency0.403216PASSBlock frequency0.943113PASSCumulative sums (forward)0.409276PASSCumulative sums (reverse)0.545923PASSRuns0635289PASSLongest run0.246932PASSRank0.513486PASSFFT0.160782PASSNonoverlapping template0.172193PASSOverlapping template0.194653PASSUniversal0.775S69PASSApproximate entropy0.764231PASSRandom excursions0.812351PASSRandom excursions variant0 797955PASSSerial (P value1)0.667959PASSSerial (P value2)0.791328PASSLinear complexity0.401947PASS


### 4.5. Running Speed and Memory Consumption

In order to test the suitability of the designed encryption algorithm in wireless sensor networks, the experiment will test the algorithm in terms of its running time and memory consumption and compare the algorithm with the traditional encryption algorithms RC5, SKIPJACK, and CWSN to obtain the following results.It is obvious from Table5 that the designed algorithm runs at 18.51byte/ms, which is 5.7, 7.28, and 1.93 higher than that of the other three algorithms, respectively, indicating that the algorithm runs faster; the memory consumption of the proposed algorithm is 96, and that of the other three algorithms is 268, 356, and 160, which exceeds that of the algorithm proposed in the study by 172, 260, and 64. After comprehensive analysis, it is shown that the proposed algorithm runs the fastest and takes up the least memory in wireless sensor networks and is very suitable for the operation of wireless sensor network.Table 5
Comparison results of running speed and memory consumption of the three algorithms.
Encryption algorithmSpeed (byte/ms)Memory (bytes) consumptionRC5 [29]12.82268CWSN [30]16.58160The algorithm designed in this paper18.5196


## 4.1. Experimental Environment

To verify the effectiveness of the proposed algorithm performance, this experiment will be implemented using C program and the algorithm will be applied to the ZigBee platform, which contains 128 KB of ROM, 4 KB of RAM, and a CC2530 microprocessor.


## 4.2. Algorithm Evaluation Index

### 4.2.1. Information Entropy

In order to test the performance of hybrid chaotic systems, i.e., to test the system complexity and security, the experiment will use information entropy to verify the performance of chaotic systems. The higher the value of information entropy, the stronger the complexity of the system. That is, the information entropy can effectively measure the system. If the length of the ciphertext is 8 bits, the information entropy is taken to be about 8 for better encryption. The expression of information entropy is as follows [25]:(19)Hx=∑xPxlog21px.The entropy of various ciphertext information of different lengths is shown in Table1.Table 1
Ciphertext information entropy.
Ciphertext length (bytes)Information entropy160.0007.9642320.0007.9765480.0007.9835640.0007.9926800.0007.9999From Table1, we can visually see that the ciphertext length is extended from 16000 to 800000, and its information entropy is increased from 7.9642 to 7.9999, which is very close to the standard value of 8. This shows that the ciphertext has strong randomness and also proves that the system has better performance, complexity, and security and can effectively avoid external attacks on network information.


### 4.2.2. Confusion and Diffusion

In encryption algorithms, confusion and diffusion are the two basic principles that must be followed. Confusion serves to complicate the relationship between the plaintext and the ciphertext, and diffusion, i.e., the maximum impact on the ciphertext through the plaintext, further enhances the security of the ciphertext.In order to verify the confusion and diffusion effect of the encryption algorithm and to evaluate and assess the performance of the encryption algorithm more objectively, the degree of completeness, degree of avalanche, and degree of strict avalanche are used as evaluation indexes in this experiment.If an encryption algorithm encrypts a plaintext ofn bits into a ciphertext of m bits, the performance of the encryption algorithm is measured using the above three criteria. Completeness represents the existence of correlation between each bit of the plaintext and all bits of the ciphertext species, and the completeness expression is as follows:(20)dc=−11nm#i,j|aij=0.The avalanche degree represents that each change of one bit in the plaintext will change at least nearly half of the bits of all ciphertexts, and the avalanche degree expression is as in equation (18):(21)da=1−2#X∗nm∑i=1n∑j=1mjbij−m2#X.The strict avalanche degree is the probability that for each bit changed in the plaintext, each bit in the ciphertext is changed at least 50%, which is expressed as follows [26–28]:(22)dsa=1−2#X∗nm∑i=1n∑j=1maij−12#X.In the above equation,aij denotes the i-th row and j-th column element inside the dependency matrix a containing n∗m elements, i takes values in the range (1, n), and j takes values in the range (1, m). If the i-th element of the plaintext is changed, the j-th element of the ciphertext changes; then aij = 1; otherwise aij = 0.bij denotes the i-th row and j + 1-th column element inside the distance matrix B containing n∗(m + 1) elements, i takes values in the range (0, n), and j takes values in the range(0, m). If the i-th element of the plaintext is changed, the plaintext is changed by j bits, and then bij = 1. The symbol X represents the total number of bits in the plaintext; # indicates the summation symbol.If the values ofdc, da, and dsa meet the criteria of equation (20), it means that the proposed algorithm possesses good results in confusion and diffusion.(23)dc=1,da≈1,dsa≈1.The trends of the above three evaluation indexes under different encryption rounds are shown in Figures10–12.Figure 10
Value ofdc for different number of encryption rounds.Figure 11
Value ofda. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)Figure 12
Value ofdsa. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)The change curves ofdc, da, and dsa indicators from Figures 10–12 show that when the number of encryption rounds is 4, da and dsa show stable trends with no significant change. The optimal number of encryption rounds can be determined to be 4, thus minimizing the resource loss of wireless sensors and ensuring the security of encrypted information.To further verify the superiority of the proposed encryption algorithm based on hybrid chaotic system, this experiment compares the designed algorithm with the traditional two encryption algorithms of RC5 and RC6 for wireless sensor network for confusion and diffusion, and the comparison results obtained are shown in Table2.Table 2
Performance comparison of the proposed encryption algorithm and traditional encryption algorithm.
AlgorithmdcdadsaRC5 [29]1.0000000.9997860.999770RC6 [29]1.0000000.9997790.999799The algorithm designed in this paper1.0000000.9998120.999772From the above table, thedc values of all three algorithms are 1, which indicates that the completeness of all three algorithms is good. da and dsa of the proposed algorithm are 0.998 and 0.999, respectively, which are both higher than those of the other two algorithms, by (0.005, 0.12) and (0.007, 0.009), respectively, compared to the RC5 and RC6 encryption algorithms. This shows that the proposed algorithm is more effective in confusion and diffusion, and the algorithm performs better than the traditional encryption algorithm.


## 4.2.1. Information Entropy

In order to test the performance of hybrid chaotic systems, i.e., to test the system complexity and security, the experiment will use information entropy to verify the performance of chaotic systems. The higher the value of information entropy, the stronger the complexity of the system. That is, the information entropy can effectively measure the system. If the length of the ciphertext is 8 bits, the information entropy is taken to be about 8 for better encryption. The expression of information entropy is as follows [25]:(19)Hx=∑xPxlog21px.The entropy of various ciphertext information of different lengths is shown in Table1.Table 1
Ciphertext information entropy.
Ciphertext length (bytes)Information entropy160.0007.9642320.0007.9765480.0007.9835640.0007.9926800.0007.9999From Table1, we can visually see that the ciphertext length is extended from 16000 to 800000, and its information entropy is increased from 7.9642 to 7.9999, which is very close to the standard value of 8. This shows that the ciphertext has strong randomness and also proves that the system has better performance, complexity, and security and can effectively avoid external attacks on network information.


## 4.2.2. Confusion and Diffusion

In encryption algorithms, confusion and diffusion are the two basic principles that must be followed. Confusion serves to complicate the relationship between the plaintext and the ciphertext, and diffusion, i.e., the maximum impact on the ciphertext through the plaintext, further enhances the security of the ciphertext.In order to verify the confusion and diffusion effect of the encryption algorithm and to evaluate and assess the performance of the encryption algorithm more objectively, the degree of completeness, degree of avalanche, and degree of strict avalanche are used as evaluation indexes in this experiment.If an encryption algorithm encrypts a plaintext ofn bits into a ciphertext of m bits, the performance of the encryption algorithm is measured using the above three criteria. Completeness represents the existence of correlation between each bit of the plaintext and all bits of the ciphertext species, and the completeness expression is as follows:(20)dc=−11nm#i,j|aij=0.The avalanche degree represents that each change of one bit in the plaintext will change at least nearly half of the bits of all ciphertexts, and the avalanche degree expression is as in equation (18):(21)da=1−2#X∗nm∑i=1n∑j=1mjbij−m2#X.The strict avalanche degree is the probability that for each bit changed in the plaintext, each bit in the ciphertext is changed at least 50%, which is expressed as follows [26–28]:(22)dsa=1−2#X∗nm∑i=1n∑j=1maij−12#X.In the above equation,aij denotes the i-th row and j-th column element inside the dependency matrix a containing n∗m elements, i takes values in the range (1, n), and j takes values in the range (1, m). If the i-th element of the plaintext is changed, the j-th element of the ciphertext changes; then aij = 1; otherwise aij = 0.bij denotes the i-th row and j + 1-th column element inside the distance matrix B containing n∗(m + 1) elements, i takes values in the range (0, n), and j takes values in the range(0, m). If the i-th element of the plaintext is changed, the plaintext is changed by j bits, and then bij = 1. The symbol X represents the total number of bits in the plaintext; # indicates the summation symbol.If the values ofdc, da, and dsa meet the criteria of equation (20), it means that the proposed algorithm possesses good results in confusion and diffusion.(23)dc=1,da≈1,dsa≈1.The trends of the above three evaluation indexes under different encryption rounds are shown in Figures10–12.Figure 10
Value ofdc for different number of encryption rounds.Figure 11
Value ofda. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)Figure 12
Value ofdsa. (a) Encryption from round 1 to round 30. (b) Encryption from round 4 to round 30.
(a)(b)The change curves ofdc, da, and dsa indicators from Figures 10–12 show that when the number of encryption rounds is 4, da and dsa show stable trends with no significant change. The optimal number of encryption rounds can be determined to be 4, thus minimizing the resource loss of wireless sensors and ensuring the security of encrypted information.To further verify the superiority of the proposed encryption algorithm based on hybrid chaotic system, this experiment compares the designed algorithm with the traditional two encryption algorithms of RC5 and RC6 for wireless sensor network for confusion and diffusion, and the comparison results obtained are shown in Table2.Table 2
Performance comparison of the proposed encryption algorithm and traditional encryption algorithm.
AlgorithmdcdadsaRC5 [29]1.0000000.9997860.999770RC6 [29]1.0000000.9997790.999799The algorithm designed in this paper1.0000000.9998120.999772From the above table, thedc values of all three algorithms are 1, which indicates that the completeness of all three algorithms is good. da and dsa of the proposed algorithm are 0.998 and 0.999, respectively, which are both higher than those of the other two algorithms, by (0.005, 0.12) and (0.007, 0.009), respectively, compared to the RC5 and RC6 encryption algorithms. This shows that the proposed algorithm is more effective in confusion and diffusion, and the algorithm performs better than the traditional encryption algorithm.


## 4.3. Statistical Analysis

In order to verify the randomness of the ciphertext after performing the encryption algorithm, this experiment will perform a statistical analysis of the length of the ciphertext, with 0 and 1 as the criteria, and the number of ciphertexts is 0 or 1, indicating that they are roughly the same. The statistical analysis table is shown in Table3.Table 3
Statistical analysis of “0” and “1.”
Length of ciphertextnNumber of “0”k1Number of “1”k2k1/nK2/n1,280,000 bits631,923648.07749.369%50.631%2,560,000 bits1,282,4251,277,57550.095%49.905%3,840,000 bits1,924.1631,915,83750.108%49.892%5,120,000 bits2,557,4392,562,56149.950%50.050%6,400,000 bits3,199,6713,200,32949.995%50.005%From the above table, it can be seen that after encryption by encryption algorithm, ciphertext of different lengths can be obtained. The number of “0” and “1” in the ciphertext is very close to each other and gets closer after increasing the length continuously, indicating that the ciphertext data achieve the 0-1 balance objective.In the plaintext, the ASCII distribution is uneven. After encryption, the ASCII distribution gradually tends to be homogeneous, which means that the encryption algorithm can effectively defend against probabilistic attacks. The ASCII distributions of both are shown in Figure13.Figure 13
ASCII distributions. (a) Plaintext. (b) Ciphertext.
(a)(b)As can be seen from the above graph, the plaintext ASCII distribution shows a large undulating peak at 50, 100, and 150, indicating a higher probability of aggressiveness and a lower defensibility in the plaintext, which makes it vulnerable to external intrusion and threats. After encrypting the plaintext, the ASCII code values shown in Figure13(b) are obtained. It can be seen that the probability of ASCII code values is all around 40%, which indicates that they are very evenly distributed and further proves that the encrypted ciphertext is more defensive and less likely to be attacked.


## 4.4. SP 800-22 Test

In order to test whether the ciphertext sequence is secure after using the encryption algorithm, this experiment is conducted to test 15 information security items of SP800-22. There are 1 million bytes in this ciphertext, and it is divided into 400 copies equally. The test results of this information are as follows. If all theP values in the table are more than 0.01, it indicates that the ciphertext sequence information meets the criteria.As can be seen from Table4, the P values of the ciphertext sequences are all above 0.01, with the lowest being 0.012351 and the highest being 0.943113. The experimental results show that all the above sequences meet the standard and satisfy the requirements of wireless sensor information security protection.Table 4
SP 800-22 test.
Statistical testP valueResultFrequency0.403216PASSBlock frequency0.943113PASSCumulative sums (forward)0.409276PASSCumulative sums (reverse)0.545923PASSRuns0635289PASSLongest run0.246932PASSRank0.513486PASSFFT0.160782PASSNonoverlapping template0.172193PASSOverlapping template0.194653PASSUniversal0.775S69PASSApproximate entropy0.764231PASSRandom excursions0.812351PASSRandom excursions variant0 797955PASSSerial (P value1)0.667959PASSSerial (P value2)0.791328PASSLinear complexity0.401947PASS


## 4.5. Running Speed and Memory Consumption

In order to test the suitability of the designed encryption algorithm in wireless sensor networks, the experiment will test the algorithm in terms of its running time and memory consumption and compare the algorithm with the traditional encryption algorithms RC5, SKIPJACK, and CWSN to obtain the following results.It is obvious from Table5 that the designed algorithm runs at 18.51byte/ms, which is 5.7, 7.28, and 1.93 higher than that of the other three algorithms, respectively, indicating that the algorithm runs faster; the memory consumption of the proposed algorithm is 96, and that of the other three algorithms is 268, 356, and 160, which exceeds that of the algorithm proposed in the study by 172, 260, and 64. After comprehensive analysis, it is shown that the proposed algorithm runs the fastest and takes up the least memory in wireless sensor networks and is very suitable for the operation of wireless sensor network.Table 5
Comparison results of running speed and memory consumption of the three algorithms.
Encryption algorithmSpeed (byte/ms)Memory (bytes) consumptionRC5 [29]12.82268CWSN [30]16.58160The algorithm designed in this paper18.5196


## 5. Conclusion

In summary, the proposed identity encryption algorithm for hybrid chaotic systems can be applied to wireless sensor network security protection, which can solve the problems of complex node resources and small memory of wireless sensor networks, and the algorithm can further enhance the defense capability of ciphertext and reduce the attack probability. The experimental results suggest that with different ciphertext lengths, the ciphertext information entropy is close to 8 after using the improved encryption algorithm, the ciphertext randomness is significantly improved, and the performance of the hybrid chaotic system is enhanced. With the number of ciphertext encryption rounds close to 4, the resource loss of the wireless sensor network is minimized, thus simplifying the network nodes, reducing the computational cost, and improving the network security. Finally, after comparing the proposed algorithm with the traditional encryption algorithm, it is found that the improved algorithm has better confusion and diffusion effects than the traditional algorithm, and the algorithm has better performance. The operation speed is faster than that of other algorithms, and the memory consumption is smaller. Comprehensively, it can be seen that the proposed algorithm can be applied and promoted in wireless sensing networks. However, due to the experimental conditions and insufficient research experience, this experiment only encrypted text information, and the proposed algorithm cannot encrypt images and other types of information well, and thus there are certain limitations, and in the future, we will start from this aspect and apply the algorithm to information such as images and videos to improve the performance and applicability of the algorithm.



---

*Source: 2308825-2022-04-01.xml*