Encryption technique based on chaotic neural network space shift and color-theory-induced distortion

Protecting information privacy is likely to promote trust in the digital world and increase its use. This trust may go a long way toward motivating a wider use of networks and the internet, making the vision of the semantic web and Internet of Things a reality. Many encryption techniques that purport to protect information against known attacks are available. However, since the security challenges are ever-growing, devising effective techniques that counter the emerging challenges seems a rational response to these challenges. This paper proffers an encryption technique with a unique computational model that inspires ideas from color theory and chaotic systems. This mix offers a novel computation model with effective operations that (1) highly confuse plaintext and (2) generate key-based enormously complicated codes to hide the resulting ciphertext. Experiments with the prototype implementation showed that the proposed technique is effective (passed rigorous NIST/ENT security tests) and fast.

Information security is an ongoing battle between security experts who strive for devising effective information protection methods and hackers who work persistently to enhance their hacking techniques to breach the information. This battle seems endless and any relaxation from the security experts probably leads to catastrophic surprises. To tip the balance to their favor, security experts have proposed many encryption techniques with different computational models. Traditional techniques use mathematical manipulations and static substitution to encrypt information [1][2][3] . Biologically based techniques make use of the complexity of human DNA sequences to hide the information 4 . Honey techniques protect the information through deceiving hackers by returning a pleasing, but fake document when attempting the wrong key 5,6 .
Although current standard encryption techniques (e.g. AES) still provide enough protection against current threats, the formidable advancements in cryptanalysis tools may soon challenge these techniques. How the current encryption techniques can effectively face the increasing security challenges or even speculate on the surprises these hacking tools may have is certainly unclear. In such a foggy setting, developing new techniques with more sophisticated computational models sounds logically justifiable. It simply gives more options to respond to emerging security challenges.
This paper offers an encryption technique with an innovative computational model. The technique uses a chaotic space shift scheme to deeply transform plaintext symbols and shift them to a totally different domain that does not correlate with the original. Furthermore, the technique uses operations whose computations are based on principles inspired by the color theory. These operations use the encryption key to generate enormously complicated codes that provide an impenetrable shield in which the ciphertext symbols are hidden. Combining chaotic systems with principles from color theory offers a unique encryption technique with an extremely sophisticated computational model that can effectively protect information against hacking techniques.
The contributions of this paper can be summarized as follows. The paper proposes a space-shift scheme that transforms the input blocks to ciphertext with high confusion and diffusion. Since the space-shift scheme is fundamentally founded on chaotic substitution and distortion operations, the confusion induced by the proposed scheme largely outperforms that induced by current methods that rely on static substitution and symbol manipulation. The paper also proposes a computationally-light method inspired by the color theory principles. This method conservatively uses the key to generate enormously complicated codes for sealing the ciphertext symbols. www.nature.com/scientificreports/ We present our contributions as follows. "Chaotic system: Lorenz chaotic system" Section introduces the chaotic system and gives the details of o novel way for initializing the chaotic system parameters. Sections Space chaotic shift process and Space chaotic shift process inverse discuss the space chaotic shift and its inverse. "Section 5" presents the technical details of the color-theory and key based process for generating sealing codes. "Section Encryption/decryption process" presents the encryption and decryption technique. We analyze the performance of the proposed technique in "Section Performance analysis" and discuss the performance analysis results in "Section Discussion". We compare the proposed technique to state-of-the-art techniques in "Section 9" and give concluding remarks and directions for future work in "Section Conclusions and future work".

Chaotic system: Lorenz chaotic system
The Lorenz is a hyperchaos system with non-periodic behavior due to its high sensitivity to the initial conditions [7][8][9] . This property is ideal for cryptography techniques because it enables the generation of long sequences of chaotic values without repeated patterns and any changes to the initial conditions results in very different sequences. Lorenz system is defined by the differential equations (1) [10][11][12][13] .
The values a, b, and c are the parameters of Lorenz system. As reported in 14 , Lorenz system falls into a hyperchaotic state for a = 10, b = 8/3, and c = 28. The effective intervals for the initial variables x 0 , y 0 , and z 0 are: x 0 , y 0 ∈ (−40, 40) and z 0 ∈ (1, 80). To use Lorenz chaotic system, it must be discretized. Although many discretization methods, we use the fourth-order Runge-Kutta method, which can be found in 14 .
The effective use of Lorenz system in cryptography requires binding the parameters ( x 0 , y 0 , z 0 , a, b, c) to values computed using the key. To the best of our knowledge, all the encryption techniques that use Lorenz system require users to provide additional values to initialize these parameters. One different way to bind Lorenz parameters is to create a seed from the key and use it in one of the known random number generators to initialize the parameters. This way is not cryptographically sound. First, the seeds for a random generator can hold far fewer bits than available in the key, which means that the generator does not fully exploit the key. Second, random number generators are not generally cryptography secure. This paper proposes an innovative technique that fully exploit the key to automatically bind Lorenz system's parameters.
Lorenz system initializer. The initializer is an efficient technique that securely exploits all the bits of the key. Figure 1 delineates the initialization process. The proposed process computes values for Lorenz's parameters using the key and it extremely sensitive to the key variations-a single bit change in the key causes drastic changes to the computed values.
Although the process is well-documented (see Fig. 1), we briefly describe its core functionality. The input to the process is the n-symbol key K, where each symbol is p bits. The output is three values for the parameters of Lorenz chaotic system ( x 0 , y 0 , z 0 ) and three random noises for distorting the system coefficients (a, b, c). The process uses the variables D, P, X, and K 1 , which are initialized as specified. The list D is populated with the integers from 0 to N-1 ( N > 2 p ) and these integers are scattered using the operation Data-based-Reorder (D) (Fig. 2). The variable X combines all the processed symbols of the key so that a change in any key symbol necessarily causes changes to the all subsequent uses of X. The variable P is initialized with the leftmost 4 bytes of the key K. The variable K 1 is assigned the rest of the key's bytes and its value is constantly updated at each iteration by appending the ASCII character " X Mod 2 p " to it.
The loop (7 through 26) binds the parameters of Lorenz system ( x 0 , y 0 , z 0 ) with appropriate values. Each iteration of the loop involves randomizing P by calling Proc(P) operation, updating P by calling update(.) operation, and indexing D using "P Mod N" to retrieve an integer and append it to Q. The local variable Q can be x 0 , y 0 , and z 0 . The operation Proc(.) randomizes its input using an XOR operation ( ∧ ) and a series of logical shifts ( << or >>> ). (Authors 15 provided many possible assignment values for the shift amounts t 1 , t 2 , and t 3 -e.g. 35, 21, and 4.) The operation update (.) updates X using the input symbol T and then uses updated X to update P by left shifting P by W and then XORing the outcome with X (W is the leftmost 3 bits of original P-before refreshing its value).
Step 9 ensures that the leftmost digit of x 0 , y 0 , and z 0 is less than 8. That is because the rang of these three variables is less than 80. Since x 0 and y 0 ∈ (−40, 40), the initializer interprets the value of Q as follows. For x 0 and y 0 , if Q < 40 assign −1 * Q to x 0 or y 0 else assign Q − 40 . Since z 0 ∈ (1, 80), the value of Q is directly assigned to z 0 without further processing.
The instructions 27-29 compute noise values N x ∈ [0, 1] for the parameters of Lorenz system (a, b, c). Each noise N x is computed by updating the variable P and dividing the value of the rightmost 24 bits by the maximum value of 24 bits (i.e. 2 24 ).

Chaotic number generation.
After initializing its parameters, the Lorenz system is used to produce three random streams of numbers corresponding to the three parameters x, y, and z. For a maximum effectiveness of the generated streams, the system is iterated for H times to ensure true transition to the chaotic state. After these H iterations, the streams ( X i , Y i , Z i ) are generated using formulas (2). Where floor(x) returns the closet integer  Figure 3 shows the flow of control of the space chaotic shift process. It handles a plaintext block by repeatedly executing (s times) the subprocesses S-Layer cNN, Chaotic Substitution, and Chaotic Mutation. Each execution of these subprocesses enormously shifts the input symbols from the plaintext space to a completely different space. As such, the process introduces maximum confusion to the encryption technique.

Space chaotic shift process
Finite Galois field GF(2 p ). The Galois field, denoted GF(2 p ) , contains a finite number of elements, where these elements are integers mod p. We succinctly discuss some of the Galois field GF(2 p ) results and invite respected readers to see 16,17 for detailed discussion.
(2)  www.nature.com/scientificreports/ Each element i ∈ GF(2 p ) is represented as an irreducible polynomial. For instance, the representation of the decimal value 177 (10110001) is x 7 + x 5 + x 4 + 1 . The four arithmetic operations addition, subtraction, multiplication, and division are different from their intuitive meaning. The addition "+" and subtraction "-" of two elements i 1 , i 2 ∈ GF(2 p ) are performed as an XOR operation between these two elements ( i 1 ∧ i 2 ). The multiplication ( ⊗ ) and division (/) are rather tricky. The multiplication of two elements is defined as a polynomial multiplication for these two numbers modulo an irreducible polynomial in GF(2 p ). The division is defined likewise except that the first element is multiplied by the multiplicative inverse of the second element. We illustrate the multiplication using an example from 17 -3F and A5 are two hexadecimal numbers.
Observe, since addition in GF(2 p ) is an XOR, the terms with even coefficients are eliminated. To find the final result, we must mod the result ( 1100010100011 2 ) by the irreducible polynomial ( 100011011 2 ) , which can be done by long division with XOR ( ∧ ) in place of subtraction as follows. cNN). The S-Layer cNN subprocess consists of a network of s layers and a processing logic that uses operations on Galois field. The s layers are chained in Hill cipher manner, where the output of the layer L i is the input for the next layer L i+1 (after receiving additional processing). Each layer L i is an n × n array whose entries are chaotic values from Galois field GF(2 p ) produced as follows. Let ( x j , y j , z j ) be triples of chaotic numbers generated by the chaotic system. We compute new chaotic values w j = MOD (floor (x j + y j + z j ) * 10 14 , 2 p ) and assign them to L i . Where floor (t) returns the closest integer greater than or equal to t and MOD is modulo operation. Note because of the module by 2 p , w j are values in GF(2 p ).

Chaotic neural network subprocess (S-Layer
The cNN subprocess manipulates an n-symbol input block Q (which is interpreted as a vector of n entries) and produces a new n-symbol block R using the following matrix multiplication R = L k Q (or r i = n j=1 l i,j q j , i=1...n). The chaotic numbers l i,j ∈ L k and the characters q j of the input block Q are to be treated as values in the field GF(2 p ). The sum ( ) and the multiplication ( ) are operations on the field GF(2 p )-not classical sum and multiplication.
The processing logic for cNN subprocess is reversible. To restore the original block Q from R = L i Q , the inverse of L i is computed using the operations of GF(2 p ). The inverse can be computed using any of the Matrix algebra techniques. By computing the inverse matrix L −1 i , Q can successfully be recovered by Q= L −1 i R. Figure 4 shows an example of the computation of the chaotic neural network. The top part of Fig. 4 shows the result A(216, 49, 120, 167, 111) of multiplying the chaotic matrix L with the input vector Q(84, 97, 107, 101, 33). Each element of A is computed by multiplying a row of the matrix L with the vector Q. For instance, 216 = 48 ⊗ 84 + 210 ⊗ 97 + 152 ⊗ 107 + 155 ⊗ 101 + 182 ⊗ 33, where ⊗ and + are the multiplication and addition under GF(2 p ) and are performed as described in "Section Finite Galois field GF ( 2 p )". The bottom part of Fig. 4 shows that the computation is reversible using the inverse of the matrix L −1 .
Chaotic substitution subprocess. The chaotic substitution subprocess is defined in Fig. 5. The chaotic behavior of the substitution subprocess is stimulated by Eq. (3), where m ∈ [1, ∞ ) and x i is a long positive integer. Equation (3) resembles the effective one-dimensional logistic chaotic map but with a better correlation to the input symbols due to the way in which the parameter m is updated. As Fig. 5 shows, the operation Update_m(c i ) updates m using a input-dependent process. First, the processed input symbols c 1 c 2 ...c i−1 are accumulated by the variable A c (initially zero) through Shift/XOR operations. The variable A c is therefore a  www.nature.com/scientificreports/ "memory" that remembers the impact of the previously processed symbols and passes this impact to influence the processing of the current input symbol c i . Second, the parameter m is randomized using a series of Shift/XOR operations that ensure deep bit-mixing. Third, m is updated by combining its previous value with the impact of the effect-carrying memory A c (the combination is performed via Shift/XOR operations). With this update to m, the computational behavior of Eq. (3) is very sensitive to the input and chaotic.
The chaotic substitution substitutes the block c 1 c 2 ...c n using Eq. (3) as outlined in Figure 5 (left-top box). The parameters m and x i of the Eq. (3) are initialized to two chaotic values obtained from the chaotic system. The input symbol c 1 is substituted with the symbol d 1 , which is computed using the initial values of x i and m since we do not have any previous input symbols. The input symbols c i ( i > 1 ) are substituted with the symbols d i that are computed using the updated values of x i and m. As such, the substitution of every input symbol c j is influenced by the preceding input symbols c k (k=1... j − 1).
The chaotic substitution subprocess is reversible provided that m and x are initialized to the same values. (The chaotic generator guarantees initializing m and x to the same values-used during the substitution-provided that the correct encryption key is provided.) Figure 5 (left-bottom box) shows the algorithmic steps of Chaotic Substitution subprocess Inverse, which effectively restores the plaintext block from the substituted block. The    Chaotic mutation subprocess. This subprocess increases the confusion of the block manipulation process. The movement of a crawler within a two-dimensional space (called mesh) may invoke a destructive behavior in the mutation subprocess that causes deep changes to the input symbols. We describe first the mesh and then show how the crawler's movement may stimulate the mutation subprocess's destructive behavior.
The mesh. The mesh is an N × N space, denoted by MSH. M/2 cells of the mesh are annotated with the directive J likewise. It is likely that some of the entries are annotated by both T and J due to the chaotic annotation. Along with the annotated mesh, we envisage a crawler that starts from an initial point (x, y) within the mesh and moves over the mesh's cells according to logic to be made precise later.(As we discuss next, the directive T triggers the mutation process while the directive J fuzzifies the crawler's move within the mesh.) Figure 6 (right) also shows Trajectory-a variable determines a move direction. The Trajectory defines 8 direction flags, which constitute all the possible moves within the mesh starting from some cell. Half of the direction flags are bidirectional because they entail changes on the rows and the columns. The flag URC is an example because a move along this flag causes the value of the rows' index to decrease and the value columns' index to increase. The other half of the direction flags are unidirectional because they entail change on either the rows or columns. The flag B is an example because moving along this flag causes the value of the row's index to increase.
Mesh-based chaotic mutation. The mutation subprocess processes the input block w 1 w 2 ...w n using the algorithmic steps in Fig. 7. First, the crawler's initial position (x, y) and the variables ( I R , I C ) are initialized with chaotic values. When the mutation subprocess considers an input symbol w i , it triggers the Mutate(.) operation only if

Mutation Subprocess
Mutate According to the Figs. 7 and 8, the Mutation subprocess is data and encryption key dependent. The input symbols influence the move of the crawler within the mesh because these symbols are used to calculate the velocities and to update the variable SEL D , which affects how the current position of the crawler is updated. The encryption key also controls the move of the crawler. The Chaotic-Jump() operation shoots the crawler's current position within the mesh using chaotic values generated based on the key. The key determines the number of the directives T and J and their topology (distribution) within the mesh. Each key impacts the number of the directives J and T and their topology within the mesh differently. More T-annotations cause more input symbols to be processed and more J-annotations cause more chaotic changes to crawler's position, largely affecting which symbols to be processed. The topology of T and J also determines which symbols in the input block to be processed. This dual-dependency of the mutation subprocess on the input and key makes it so effective in inducing a great confusion in the output.
The mutation subprocess is reversible. Figure 9 delineates the inverse steps. Note, the inverse mutation subprocess executes roughly the same steps as the mutation subprocess. The key difference is that in the mutation subprocess inverse, the input symbol u i is divided by V 3 instead of multiplied.

Space chaotic shift process inverse
This process reverses the impact of the space chaotic shift process and restores the plaintext block. The inverse process uses pretty similar processing steps as the space chaotic shift process ( Fig. 3) with some modifications. First, the inverse process uses the inverse of each subprocess. Second, the inverse process executes the inverse subprocesses backwards. Therefore, if we denote inverse of the chaotic mutation subprocess by C −M , the inverse of the chaotic substitution subprocess by C −S and the inverse of the chaotic neural network subprocess layer L i by

Sealing layer
The sealing layer generates key-based enormously complicated codes that seal the ciphertext symbols and greatly confuse the ciphertext (the output of the space shift stage). Figure 10 shows the core components of this layer and the flow of control. The sealing layer receives the encryption key, which is processed by the Diffusion stage. The Input Expansion stage expands the diffused key to a sequence of d bytes. The Distortion stage uses the left d 1 bytes of the output sequence and generates hiding codes. The right d 2 bytes are fed back to the diffusion stage for producing more expanded sequences. To impose more confusion on the input of the Diffusion stage, the d 2 bytes feedback are noised by padding chaotic values to it (obtained from stream Z of the chaotic generator). The number of padded chaotic values can be between 0 and d 2 (the length of the feedback) and this number is determined by the first chaotic number to be padded as follows. If H is the first chaotic value, the number of chaotic values to be padded to the feedback is "H Mod d 2 ". This chaotic noise is extremely important because it greatly varies the input to the diffuser, which complicates the generated key-based sealing codes. The following subsections present the technical details of the sealing layer stages.
Diffusion stage. The diffusion stage processes its input in many rounds as illustrated in Fig. 11. Each round executes forward and backward bit-mixing along with a chaotic substitution. The forward bit-mixing handles the input b 1 b 2 ...b n using substitution and XOR instructions. The symbol b 1 is handled by XORing (" ∧ ") it with a value u k provided by the controller and the outcome of the XOR operation is substituted using the Substitute() operation to yield c 1 . The symbols b i ( i > 1) are handled by XORing each symbol b i with the previous symbol c i−1 and then substituting the outcome of the XOR operation. The backward  www.nature.com/scientificreports/ bit-mixing uses similar logic except that it starts from the end of the input block c 1 c 2 ...c n . It handles the symbol c n by XORing it with a value u k+1 provided also by the controller and substitutes the outcome. The remaining symbols are manipulated using similar logic as the forward bit-mixing. The Substitute() operation substitutes its input argument t i using a stochastic behavior. This operation uses a 64-bit variable x (initialized with a chaotic value) to accumulate the impact of the previously processed input symbols through an XOR operation ( x ∧ =t i ). The stochastic behavior is induced by a system of XOR-Shift operations that randomize the variable x. (The values of a, b, and c are specified as in 15 .) The Substitute() operation processes its input argument t i by first randomizing the variable x using the system of XOR-Shift and then multiplying t i by "x mod 2 p ". Respected readers should interpret " ⊗ " as the multiplication in Galois field GF(2 p ). Additionally we take "mod 2 p " since each input symbol consists of only p bits.
The diffusion stage is the primary source of confusion for the sealing layer. The bidirectional bit-mixing enables the diffusion stage to detect the change wherever occurs in the input and transmit this change back and forth to cover all the output symbols, causing every output symbol to change. The stochastic substitution operation props the sensitivity of the bit-mixing. Because the accumulator variable x collects the impact of all previously processed input symbols, any change in the previously processed symbols impacts the substitution of the subsequent input symbols. This props the sensitivity of the forward/backward bit-mixing due to embedding variations of the input in the processed symbols.
Input expansion stage. The sealing code generation requires continuous expansion of the key to produce arbitrary length hiding codes. Although literature has reported many techniques that can expand a sequence of n symbols to a longer sequence (e.g. 18,19 ), this paper utilizes SHA-512 20 . SHA-512 is a one-way, fast, and has high avalanche effect; making it a perfect choice for key expansion. It hashes a string S with a size of bits ( 0 ≤ ≤ 2 128 ) and produces a corresponding hash value of length 64 bytes (512 bits). (The technical details of SHA-512 is beyond the scope of the paper and interested readers are kindly referred to 21 .) We use the leftmost 48 bytes as an input to the Distortion stage and the right 16 bytes as a feedback to Diffusion stage for producing more sequences.
Distortion stage. The distortion stage uses an effective computational model whose functionality is based on physical principles inspired by the color theory. In particular, the distortion stage uses computations that are based on the color theory to generate distortion values and trigger distortion operations that consume the generated distortion values to deeply distort the input symbols. As Fig. 10 shows, the distortion stage continuously consumes two triples (x, y, z) and (u, v, w) and produces an output triple (sealing code).
The controller. Figure 12 outlines the inputs and the outputs of the controller. The controller generates four control signals (Map, Map-Distort, Distort-Map, and Skip) that adjust the functionality of the mapping distorter-i.e. determine how the mapping distorter processes its input triples. The four control signals are described in Table 1. The controller generates these four signals using two fundamental themes inspired from the Color theory: relative luminance and color contrast ratio 22,23 . Given an input triple (x, y, z), which can be Where, the linear values R (red), G (green), and B (blue) are computed for the triple (x, y, z) using the logic (5) proposed by 23 . Note, the computation assumes 8-bit representation for x, y, and z.
Given the relative luminance L, the Color theory provides a way to compute the contrast ratio CR between two color triples E 1 ( r 1 , g 1 , b 1 ) and E 1 (r 2 , g 2 , b 2 ). Specifically, we compute first the relative luminance L E1 and L E2 for respectively E 1 and E 2 using Eq. (4) and then combine them ( L E1 and L E2 ) using Eq. (6) adopted from 22 .

Map
This signal enables mapping the triple (u, v, w) to the layer without distortion.

Map-Distort
Post-Distortion: this signal enables mapping the triple (u, v, w) to the layer and then distorting the outcome of the mapping.

Distort-Map
Pre-distortion: like Map-Distort except that the triple is distorted first then mapped to the layer.

Skip
The triple skips all subsequent layers and is passed to the output (i.e. no mapping to the current layer nor to the subsequent layers).  (7).

Scientific Reports
In addition to generating the control signals, the controller uses the contrast ratio to generate the values u i using the logic in Fig. 13. These values are used to support the functionality of the mapping distorter and the diffusion stage. As Fig. 13 shows, the generation of u i uses the Xorshift RNGs algorithm 15 , which operates on the input Seed. The Seed is created by XORing the variables CR 64 and Initial 64 , where CR 64 is the leftmost 64 bits extracted from the fraction part of the contrast ratio (CR) and Initial 64 is a 64-bit variable whose initial value is zero. The Xorshift RNGs is repeated L times to produce L values u i . After generating the values u i (i = 1...L) , the variable Initial 64 is updated by XORing its current value with the recent value of the Seed. This means that generating new values u i (i = 1...L) is necessarily affected by not only the current CR 64 , but also by the previous values of CR 64 , which are accumulated in the variable Initial 64 .
The mapping distorter. The mapping distorter consists of a sequence of m layers (see Fig. 14). The output of the current layer is the input for the next one. The connectors between the layers are called mapping links. Each layer L i consists of 2 p cells filled with the integers 0...
, which provides input to both the next layer L i+1 and the controller.
The mapping distorter declares a set of distortion operations ( Table 2). These operations distort the outcome of the mapping process, making this process non-linear. The distortion operations are placed in a list and reordered using a sequence of chaotic values obtained from the chaotic system. The mapping distorter chooses the operations for manipulating the input triples using three state variables f, s, and t, where these variables select distortion operations to respectively process the first, the second, the third element of the input triple. The initial values for (f, s, t) are zeros. These variables, however, are updated using the scheme (8) before using them for operation selection. (The valuesu 1 , u 2 , u 3 are generated using the contract ratio.) The mapping distorter defines three distortion levels for the input triple (u, v, w). Levels 1, 2, and 3 distort respectively only one element, only two elements, or all the three elements of the triple. Because the triple has three elements, there are 7 different configurations: distort only one element (3 configurations), distort two elements (3 configurations), and distort the three elements (1 configuration). To select any of these configurations, the mapping distorter uses the logic (9). The state variable q is initially zero, but updated-prior to any use-using q = ((q<< 1) ∧ u 4 ) Mod 2 p , where u 4 is obtained from the contrast ratio ("The controller" section).
After describing each component of the distortion stage, we explain how it works. Figure 15 summarizes the distortion stage flow of control. The input to the distortion stage is two triples (x, y, z) and (u, v, w), where the first triple is directed to the controller while the second is directed to both the controller and mapping distorter. The output of the distortion layer is a new triple ( u ′ , v ′ , w ′ ).
The controller generates a control signal and produces the values u i (i=1...L), where the first four u i (i = 1...4) are used to update the values of the state variables f, s, t, and q. The mapping distorter maps the triple (u, v, w) to its layers L i (i=1...m) according to the control signal. If the received control signal is Skip, the mapping distorter does not process the input triple (u, v, w) and passes it to the output without modification. If the signal is Map, the triple is mapped to the current layer L i . If the signal is Distort-Map, the mapping distorter uses the state variable q to determine the level of the distortion(one, two, or the three elements of the triple) and uses the variables f, s, and t to select the distortion operations. The number of selected operations depends on the level of the distortion. For instance, if the level is to distort three elements of the triple, the variables f, s, and t are used to select three distortion operations. The distorted triple is then mapped to the layer L i (after being distorted). The same logic applies if the control signal is Map-Distort except that the triple is mapped to the layer L i and then the outcome of the mapping is distorted.
This process is repeated for each layer L i of the mapping distorter except if the signal is Skip. (Because the control signal Skip interrupts the mapping and the triple is passed to the output without additional mappings.) Therefore, if there are more layers to map the triple to, the distortion layer updates (u, v, w) to the latest produced value and repeats the processing for the next layer L i+1 . Figure 16 delineates the proposed encryption technique. The Chaotic System uses the key to generate three streams (X, Y, Z) of chaotic values for supporting the functionality of the encryption different processes. The three streams (X, Y, Z) are combined as to described in "Section Chaotic neural network subprocess (S-Layer cNN)" for populating the entries of the cNN layers L i 's and then for initializing the two parameters (x, m) of the

Encryption/decryption process
Switch(q) Case < (2 q /7) * 1 : distort the first element in the triple Case < (2 q /7) * 2 : distort the second element in the triple Case < (2 q /7) * 3 : distort the third element inthetriple Case < (2 q /7) * 4 : distort first/second elements in the triple Case < (2 q /7) * 5 : distort first/third elements in the triple Case < (2 q /7) * 6 : distort second/third elements in the triple Case < (2 q /7) * 7 : distort all elements in the triple The encryption technique processes the input plaintext in n-symbol blocks. The Space Shift processes each block in s iterations (s is the number of the neural network layers L i ). At any iteration i, the Space Shift processes the input block using the layer L i (of the chaotic Neural Network, cNN) and then distorts the output of the layer L i using Chaotic Substitution and Chaotic Mutation operations. Because both the chaotic substitution and chaotic mutation are nonlinear and chaotic, they have a very sophisticated computational behavior that highly confuses the input. The output of the chaotic shift receives further confusion by the sealing layer. The sealing layer hides the output symbols by XORing them with enormously complicated key-dependent codes. Figure 17 shows the decryption process. The initialization step follows the same steps of the encryption except for the need to compute the inverse of the layers of the chaotic neural network. Once the process is initialized, the decryption process restores the plaintext block using the inverse of the encryption operations (see Fig. 17). The decryption process first handles the ciphertext block using the Sealing Layer to remove the key impact. The output of the Sealing Layer goes through a sequence of operations: Chaotic Mutation Inv⇀Chaotic Substitution Inv⇀cNN-Inv layer. Each Inverse operation removes the impact of the corresponding encryption operation on

Performance analysis
We evaluate in this section the performance of the proposed technique. We first analyze the important properties of the sealing code layer. Specifically, we analyze the entropy, avalanche effect, and the randomness of the sealing codes. These are very important properties and the sealing code must have high entropy, high avalanche effect, and random to be effective. We next evaluate the performance of the encryption technique by running different security tests on the ciphertext.
Sealing code performance. The test case consists of a large set of 128-bit keys. For better matching the possible distribution of the keys in real-world applications, we used 2500 random keys generated using the service (passwordsgenerator.net), 170 handcrafted keys, 3278 low entropy keys. The low entropy keys (3278) were generated using an input key of all zeros as follows. We created 128 keys by flipping only the i th bit of the input key (i=1...128). The rest of the keys are created by flipping j bits at random positions of the input key (j=2, 3, 4, 5...64). By flipping only up to half of the key, we kept the resulting keys with low entropy. The sealing code layer used each of these keys to generate large sealing code sequences. Each sequence is of 128,000 symbols-each symbol is 8 bits. Since the execution of the diffuse stage and the mapping distorter (two subprocesses in the sealing layer) depends on the number of rounds and the number of mapping layers, we analyzed the impact of rounds and the mapping layers on the overall performance of the sealing layer. Therefore, the sealing layer was executed several times for different values of the rounds and the mapping distorter layers. Figures 18 and 19 shows the performance of the sealing layer in terms of two important performance metrics: entropy (Fig. 18) and autocorrelation (Figs. 19). The numbers represent the average over all the sequences. The figures show a general improvement pattern: the values of the entropy improve (getting closer to the ideal value 1) and the values of the autocorrelation improve (getting closer to 0) as the number of rounds and the number of mapping distorter layers increase. However, examining the figures, one can see that there is no significant improvement beyond the 4 round (DIF-4) and 4 mapping distorter layers. Since increasing the number of rounds and mapping layers entails an increase in the execution time, we fixed the number of rounds to 4 and the number of mapping layers to 4. We refer to this configuration by the effective configuration. Table 3 shows the results of the ENT random test on the sequences that were generated using 4 rounds for the diffuse stage and 4 layers of the mapping distorter. The table shows the result of five important ENT randomness tests. The entropy is close to 1 (the ideal values for bit sequence), the Chi-square values indicate that the sequences are random, the estimation for π is close to the actual value with a tiny error (please see 24 for ENT test values interpretation). The serial correlation coefficient is sufficiently small (close to 0) and the arithmetic mean is close to the ideal value 0.5. These ENT test results indicate that the sequences generated by the sealing layer does not deviate from random.
To effectively examine the avalanche effect of the proposed technique, we used a low entropy 128-bit key of all zeros. We then constructed different perturbed keys by flipping bits at random positions of the low entropy input key. Due to the prohibitively large possibilities, the number of flipped bits is 1, 2, 3,4,8,12,16,24,32,64,96. For each number of flipped bits, we constructed 20 perturbed keys. For instance, we constructed different 20 perturbed keys, where each key is created by flipping the input key in a single random position. The sealing code layer produced, for each key, a code sequence of 1024 symbols (8192 bits). In addition, when the sealing code layer produced the code sequence, it used the effective configuration (4 rounds for the diffuse stage and 4 layer for the mapping distorter). We computed Hamming distance between the sequence generated using the input   www.nature.com/scientificreports/ key and the sequences generated using its corresponding perturbed keys. (Hamming distance is the number of bit differences between two sequences at the corresponding positions). Figure 20 shows the average avalanche effect based on the number of flipped bits. As the figure shows, the minimum average avalanche exceeds 5000 bits difference. This means when we change a bit or more in the input key, the bit difference between the sequence generated from the input key and the sequence generated from its perturbed key exceeds half of the length of the sequence (8,192 bits). The confidence intervals around the average-represented by the error bars-show that there is no significant difference in the average of bit difference when the number of the flipped bits changes. These numbers are indicative and show that the sealing code layer has a large avalanche effect.

Security analysis. This section presents the performance analysis of the proposed encryption technique.
Successful testing considers all the parameters that impact the performance of the technique. These parameters include key variations, plaintext variations, and the entropy of the plaintext and the key. National Institute for Standards and Technology has provided a well-designed framework for thoroughly examining the performance of encryption techniques 25,26 , which include the following three sets of data.

Key Avalanche Data Set
Examines the impact of the key's changes on the randomness of the resulting ciphertext (fixed plaintext). 2. Plaintext Avalanche Data Set Examines the impact of the plaintext's changes on the resulting ciphertext (fixed key).

Plaintext/Ciphertext Correlation Data Set
Examines the correlation between plaintext/ciphertext pairs (high correlation means bad security).
We created the above three sets consistently with the specification 25 . For the key avalanche, we created and analyzed 1200 sequences of size 524,288 bits each. We used a fixed low entropy 4096-bit plaintext of all zeros and 1200 random keys each of size 128 bits. Each sequence was constructed by concatenating 128 derived blocks created as follows. Each derived block is constructed by XORing the ciphertext created using the fixed plaintext and the 128-bit key with the ciphertext created using the fixed plaintext and the perturbed random 128-bit key with the ith bit modified, for 1 ≤ i ≤ 128 . For plaintext avalanche, we created and analyzed 1200 sequences of size 524,288 bits each. The construction of the sequences is similar to the construction of the key avalanche set except we used 1200 random plaintexts of size 4096 bits and a fixed low entropy 128-bit key of all zeros. For plaintext/ ciphertext correlation, we constructed 800 sequences of size 614,400 bits. Each sequence is created as follows. Given a random 128-bit key and 1200 random plaintext 512-bit blocks, a binary sequence was constructed by concatenating 1200 derived blocks. A derived block is created by XORing the plaintext block and its respective ciphertext block. Using the 1200 (previously selected) plaintext blocks, the process is repeated 799 times (one time for every additional 128-bit key).
We ran the NIST battery of randomness test on the above three data sets. Tables 4 and 5 show the results presented in terms of the number of sequences that passed a specific test (Success) and their percentages (Rate%). The used level of significance is α = 0.05 , which means ideally no more than 5 sequences out of 100 may fail a corresponding test. In practice, however, any set of data is likely to deviate from this ideal. To consider this, we computed an upper bound on the number of the sequences that may fail using the formula (10) Tables 4 and 5 showed a high percentage pass. More than 96% of the key/ plaintext data set sequences and more than 95% of the plaintext/ciphertext data set sequences passed the NIST randomness tests. The number of sequences that failed any of the randomness tests is much less than the maximum number that is expected at a significance level of 0.05. Tables 6, 7, and 8 show the ENT battery of randomness tests results. These tests give additional insights about the performance of the proposed technique. Referring to these tables, the entropy is so close to 1 (ideal value is 1). The arithmetic mean is close to 0.5 (ideal exactly 0.5). Having a very close approximation for the π , with an error magnitude of 10 −4 , using Monte Carlo method indicates very good randomness of the sequences. Finally, the serial correlation is so close to zero (ideally zero), which statistically indicates that there is no dependency between a bit and its predecessor.   Deferential attacks. Differential attacks are so effective and very challenging to encryption techniques. They can exploit vulnerabilities due to the lack of effective confusion that can hide the key identity. Therefore, if the encryption technique does not induce enough confusion to hide the patterns of the key, attackers can flip one or more bits in plaintext and observe the differences in the values of the bits between the two ciphertexts to identify a pattern that helps crack the encryption technique 27 . The proposed encryption technique uses the key either to initialize the chaotic system parameters or to generate the sealing code. The initialization process ("Chaotic system: Lorenz chaotic system" section) applies nonlinear operations to generate initialization values. These operations ensure deep manipulations of the key through key splitting and constant randomization-update operation.
The key trace (pattern) is consequently eliminated. The sealing code layer also uses the key. The key is deeply processed using a one-way expansion algorithm and a distortion operation whose functionality is controlled by color theory principles. As analyzed in "Sealing code performance" section, the output of the sealing layer has very high entropy, is random, and has a high avalanche effect (flipping a bit forces more than 1 2 of the output bits to change).
Classic attacks. Classic attacks involve four powerful types: ciphertext-only, known-plaintext, chosen-plaintext, and chosen-ciphertext attacks. Although all of these attacks can seriously threaten the encryption technique, chosen-plaintext attack is the most effective one [27][28][29] . If the encryption technique can resist this attack, it can resist the others 30 .
The proposed encryption technique resists the chosen-plaintext attacks due to both the space chaotic shift and the sealing layer. The space chaotic shift processes plaintext using three nonlinear subprocesses . The chaotic neural network subprocess makes deep changes using chaotic numbers and irreducible operations of Galois field. The chaotic substitution intensifies the confusion through nonlinear substitution for the symbols of the input. In particular, the chaotic substitution subprocess uses plaintext to induce chaos in the substitution due to the enhanced logistic map equation. The chaotic mutation imposes chaotic and fine-grained changes to the symbols. The output, therefore, is sharply different and not correlated to the input due to the accumulated confusion induced by these three nonlinear operations. The sealing code layer produced key-based code sequences that are random with high entropy and avalanche effect. The contribution of the sealing code layer is additional confusion resulted from the variations of the key. This additional confusion makes it impossible for hacking techniques to locate and follow any patterns that may lead to knowing the input plaintext.
Time complexity analysis. The major merit of the proposed technique is that the two principal components-the space chaotic shift and the sealing layer-are completely independent. They can work in a parallel mode. Therefore, we analyze the time complexity for each and consider the maximum complexity of the two as the complexity of the technique.
The space chaotic shift process consists of three subprocesses. The chaotic neural network subprocess multiplies a matrix with a vector of n entries (the input block). The complexity of this multiplication is O(n), where n is the input size. The chaotic substitution subprocess handles its input block (n symbols) using simple operations-XOR, integer multiplication, and logical shift. Each of these simple operations is O(1) and consequently, the total time is O(n). The chaotic mutation subprocess includes operations that access the mesh by directly indexing a cell or two, XOR operation, and multiplication under Galois field. These operations are simple and each is O(1). We   According to the definition of Big-O, the time complexity of the proposed technique is O(n). To the best of our knowledge, there is no encryption technique whose computational model is less than O(n) (including AES 19 ). Figure 21 shows the time required for different input sizes (megabytes). The hardware specification was an Intel Core i5 with 4GB memory and windows 10 (OS). The bars represent the time required by the space chaotic shift process to produce its final input. The curve represents the time required by the sealing layer to generate a sealing code sequence of the same size as the ciphertext. The curve and the bars are increasing roughly linearly. This is consistent to a large extent with the complexity analysis. Although the figure shows that the sealing layer requires a bit more processing time than the space chaotic shift, this extra time is not significant.

Discussion
We discuss now the experimental results presented in "Performance analysis" section. Based on the results in Tables 4 and 5, the output (ciphertext) of the proposed technique passed the NIST randomness tests due to the high percentage of sequences that passed each randomness test and the low parentage of sequences that failed. Referring to Tables 4 and 5, one can see that the number of sequences that failed an individual test is less than the maximum number of sequences that may fail a test (as estimated by the NIST formula 10). Additionally, the results of ENT randomness tests shown in Tables 6, 7, and 8 indicate that the method output is random. The wellestablished NIST framework, which was used to test the standard encryption technique competition, states that encryption techniques whose output passes the defined randomness tests are considered effective. Accordingly, since the proposed technique passed all the randomness tests with the number of failed sequences less than the maximum number of sequences that may fail, it then is effective.
The experimental analysis of the effectiveness of the proposed technique is supported also by the theoretical analysis ("Security attacks resistance" section). The high entropy and avalanche effect of the key sequence generated by the sealing layer ensure that the key is secure 27 . Furthermore, we showed in "Security attacks resistance" section that our technique can resist a chosen-plaintext attack. Based on 28,29 , if the technique can resist a chosenplaintext attack, it can resist all other types of attacks.
According to our discussion in "Time complexity analysis" section, the technique is time-efficient. The theoretical analysis for the time showed that the technique has linear time complexity. This is indicated by the upper limit of the time complexity O(n). This theoretical analysis (in terms of Big-O) is well supported by the time measurements in Fig. 21, which plots the time requirement for encrypting text files of varying sizes. One can www.nature.com/scientificreports/ observe that the time required for encrypting each file increases as the size of the file increases, but this time increase is pretty linear.
To further examine the time performance of the proposed technique, we compared it to state-of-the-art encryption techniques. In particular, we used two standard algorithms AES and DES as a base for time performance comparison. Because the proposed technique was implemented in Java, we also used the Java implementation of AES and DES so that we have similar software platform. The hardware platform was an Intel Core i5, 4GB memory, and Windows 10. We executed the proposed technique and the two baseline techniques on inputs with different sizes. (The techniques AES and DES were executed using ECB mode.) For each input, we executed each technique 20 times and recorded the average over the 20 runs. Figure 22 plots the average execution time for the proposed technique and the two baseline techniques. (Table 9 shows the average execution time numbers rounded to the closest integer). As can be seen, DES required longer time than AES and the proposed technique for all the input sizes. The proposed technique and AES required almost the same time for input sizes up to 2MB. However, the execution time of the proposed technique becomes slightly better (shorter) than the execution time for AES for larger input sizes (>2MB). These numbers indicate that the proposed technique has an execution time similar to the time required by state-of-the-art techniques and can be widely used for realworld applications. Although it would be more comprehensive to compare the proposed technique with more encryption techniques, we think that the comparison with AES and DES provides sufficient evidence for the time efficiency of the proposed technique. (AES and DES are standard, have an efficient implementation in Java platform, and AES is known for its execution time efficiency 31 .)

Related works
This section compares the proposed technique to state-of-the-art techniques. In the comparison, we show the properties of the computational model of each technique and then compare these models with the computational model of the proposed technique.
Chaotic systems provide a significant foundation for cryptographic applications due to their hypersensitivity to the initial conditions and input parameters. Slight modifications to the initial conditions or the inputs produce unpredictable behavior 32,33 . Although chaotic systems are mostly used in image cryptosystems, their  www.nature.com/scientificreports/ hypersensitivity and unpredictability are certainly applicable to text cryptosystems 34,35 . The techniques 17,36-40 used chaotic systems for inducing enough confusion in the resulting ciphered image. The authors 41 proposed a color image encryption technique based on one-time keys and robust chaotic maps. This technique used a linear piecewise chaotic map to generate the keys with a real random generator. The proposed technique 29 used cyclic shift and sorting to permutate the image bits and produce high confusion. The proposed technique 42 used dynamic piecewise coupled mapping lattice, which generates good chaotic behavior that induces large confusion in the resulting ciphered image. In 43 , the proposed image encryption technique used a semi-tensor product matrix along with a Boolean network as fundamental operations for encrypting images. Fractal Sorting matrix (FSM) with global chaotic pixel diffusion is proposed in 44 . Based on the FSM and global chaotic pixel diffusion, this paper constructs a more efficient and secure chaotic image encryption algorithm than other approaches. Hybrid chaotic mapping and dynamic random growth techniques are used in 45 . These chaotic noises are used to increase the security of the technique and its resistance against classical attacks (e.g. chosen-plaintext). Non-chaotic encryption techniques (e.g. 46 ) use the "manipulate-and-mask" principle to produce the necessary confusion and diffusion for the technique. The manipulation part is ensured by operations such as static substitutions, permutations, and shifting. The mask part depends on the encryption technique and ranges from producing key-based code through performing simple manipulations on the key using patterns such DNA sequences. The techniques 19,31,[47][48][49] use static substitution and mathematical manipulations to generate sufficient confusion that boosts the security of the ciphertext. The use of the key is restricted to generating a sequence of key-based symbols that are XORed with the ciphertext symbols. The generation process for the key-based symbols depends also on static substitution, symbol swap, and shift operations. DNA-based techniques make use of the sophisticated structures of the DNA sequences of living beings [50][51][52] . These techniques first manipulate their input using manipulation operations and then hide the resulting messages within the complicated human genomic DNA. As such, the security of such methods is built only partially on the manipulation operations but mainly on the complexity of the DNA. The proposed technique 53 is based on chaotic maps along with DNA coding. This method has two powerful operations that increase its effectiveness: the confusion of the pixels by transforming the nucleotide into its base pair for random times and the generation of the new keys according to the plain image and the common keys. Authors 54 proposed a novel image encryption scheme based on DNA sequence operations and a spatiotemporal chaos system to encrypt images.
Authors also proposed many important neural network based encryption techniques. Authors 55 proposed a double image encryption algorithm based on convolutional neural network and dynamic adaptive diffusion. The technique ensures the security of double image and improves the encryption efficiency and reduces the possibility of being attacked. The technique proposed in 56 uses continuous-variable quantum neural network to induce high confusion and thus secure the ciphered images.
Honey encryption techniques [57][58][59] are designed to withstand the brute-force attacks. The idea is to respond intelligently to incorrect key attempts with a decryption that yields a plausible, but fake document. This way attackers will be confused and have no clue whether they actually getting the right plaintext.
The proposed technique substantially differs from these techniques and has better security. Although the "manipulate-and-mask" techniques show reasonably high diffusion and confusion, they lack the capabilities of the proposed method. First, the proposed method utilizes a chaotic-driven scheme that makes the substitution and replacement inherently chaotic. This is significantly more effective than a pure static substitution and deterministic manipulation operations. The DNA techniques capitalize on the complexity of the DNA sequences to secure the information. The proposed technique, however, has a robust computational model that produces complicated hiding code that resembles the DNA sequences. The hiding code production is based on the encryption key, which fits perfectly with the main objective of encryption "the encryption security is fully built on the key". The Honey techniques base their security on the ability to confuse attackers. The proposed technique uses better techniques that significantly raise the confusion due to chaos driven behavior. Additionally, the proposed technique is more general. The Honey techniques are applicable only on short plaintext. www.nature.com/scientificreports/ operation to process the key. The sealing layer uses the diffusion stage and other color theory-based operations to avoid having any trace of the key in the resulting sealing code. We have two directions for future work. We plan to use more test cases. We also plan to use our technique in image encryption. We think that this method is likely to outperform the current image encryption techniques because it has a powerful ability to induce confusion and high bit-distortion capabilities.