Hassan Noura

Lama Sleem

Mohamad Noura

Mohammad Mansour

Ali Chehab

Raphael Couturier

Raphaël Couturier

A new efficient lightweight and secure image cipher scheme

Introduction

Living in an era of technology and communication, many researchers have to focus their attention on security issues. More and more people use the Internet and social media applications. Their personal data is placed on a world wide network at the risk of seeing their privacy invaded. Protecting our personal data has become of major importance and researchers are competing to build different algorithms that can guarantee the safety of our images in particular. Securing images can take place on two levels: a pixel level and a compression level. In this paper, we worked on a pixel level that ensures a higher level of security since every pixel is being processed and encrypted. While on the compression level, pixels are being nominated and chosen if they meet a specific predefined condition and are then subjected to encryption.

In fact, recently, a set of compression algorithms for encrypted images has been presented to enable the reduction of the size of the encrypted image such as [START_REF] Zhang | Compressing encrypted images with auxiliary information[END_REF][START_REF] Xinpeng ; Zhang | Compression of encrypted images with multi-layer decomposition[END_REF][START_REF] Zhou | Scalable compression of stream cipher encrypted images through context-adaptive sampling[END_REF]. This means that encrypting the image in pixel level is preferable ensuring a full protection. Employing the recent 1 compression algorithms over encrypted images permits to reduce the overhead in terms of storage and communication. Based on these works, the proposed solution is presented and realized at the pixel level.

Problem

In fact, the existing symmetric-key standard encryption algorithms such as DES (Data Encryption Standard) [START_REF] Biham | Differential cryptanalysis of the data encryption standard[END_REF] and AES (Advanced Encryption Standard) [START_REF] Daemen | The design of Rijndael: AES-the advanced encryption standard[END_REF][START_REF] De | An aes-based robust image encryption scheme[END_REF][START_REF] Upadhyaya | Image encryption: Using aes, feature extraction and random no. generation[END_REF] are used for image encryption. However, the traditional techniques are defined for texts and are not suitable for multimedia contents since images and texts possess different characteristics. The intrinsic features of traditional ciphers such as AES or DES are based on applying a round function for multi-times, which requires higher execution time and more resources. This number of rounds is higher and depends on the size of the employed secret key to prevent differential and linear attacks. The reason that r is relatively high is that these algorithms have a static structure and consequently substitution and diffusion layers are known and public. This has a negative impact in terms of execution time and resources, which is a critical problem in the real-time delivery of multimedia streams [START_REF] Dan | Image encryption based on bivariate polynomials[END_REF] or for tiny devices that cannot handle high latency.

Related Works

Therefore, redesigning the existing symmetric cryptographic algorithms is still in progress. Several recent approaches are presented which follow the dynamic structure which allows the number of rounds r to be reduced and makes the cipher's substitution and diffusion processes variable and unknown to the attackers. One of these recent approaches is the chaotic one which consists of a non-linear dynamic system that apparently looks random. Because of its extreme sensitivity to intrinsic conditions, chaos was implemented extensively to build the cryptographic algorithms of digital images as in [START_REF] Akhshani | A novel scheme for image encryption based on 2d piecewise chaotic maps[END_REF][START_REF] Shahram | Chaotic image encryption system using phase-magnitude transformation and pixel substitution[END_REF][START_REF] Jun-Xin Chen | A fast chaos-based symmetric image cryptosystem with an improved diffusion scheme[END_REF][START_REF] Enayatifar | Chaos-based image encryption using a hybrid genetic algorithm and a dna sequence[END_REF][START_REF] Huang | Implementation of gray image encryption with pixel shuffling and gray-level encryption by single chaotic system[END_REF][START_REF] Kumar | Extended substitution-diffusion based image cipher using chaotic standard map[END_REF][START_REF] Mohammad Seyedzade | A novel image encryption algorithm based on hash function[END_REF][START_REF] Mohammad | A fast color image encryption algorithm based on coupled two-dimensional piecewise chaotic map[END_REF][START_REF] Tong | A new feedback image encryption scheme based on perturbation with dynamical compound chaotic sequence cipher generator[END_REF][START_REF] Wang | A novel colour image encryption algorithm based on chaos[END_REF]. Unfortunately, the majority of chaos-based encryption algorithms are not considered particularly secure, and many of them have been cryptanalyzed successfully as in [START_REF] Li | Breaking an image encryption algorithm based on chaos[END_REF][START_REF] Li | Cryptanalysis of a chaotic image encryption method[END_REF][START_REF] Rhouma | Cryptanalysis of a new substitutiondiffusion based image cipher[END_REF][START_REF] Zhang | Analysis and improvement of a chaos-based symmetric image encryption scheme using a bit-level permutation[END_REF], because of the instability coming from the periodicity of mapping [START_REF] Huang | Security analysis of image encryption based on twodimensional chaotic maps and improved algorithm[END_REF][START_REF] Lou | A steganographic scheme for secure communications based on the chaos and euler theorem[END_REF] and the finite computing precision that makes the system defenseless against different kinds of attacks [START_REF] Alvarez | Cryptanalyzing a nonlinear chaotic algorithm (nca) for image encryption[END_REF][START_REF] Arroyo | Cryptanalysis of an image encryption scheme based on a new total shuffling algorithm[END_REF].

Furthermore, other approaches have recently been introduced and are based on a hash function to ensure authentication, integrity and data confidentiality such as in [START_REF] Cheddad | A hash-based image encryption algorithm[END_REF][START_REF] Wang | One-way hash function construction based on 2d coupled map lattices[END_REF]. A hash function is essential because of its properties that prevent any retrieval of useful information about the secret key used. In [START_REF] Cheddad | A hash-based image encryption algorithm[END_REF], a hash function is presented and used to encrypt images. Digital images have been encrypted using the standard Secure Hash Algorithm (SHA-2) along with a compound forward transform and a password provided by the user. Another hash-key-based encryption scheme is discussed in [START_REF] Norouzi | A novel image encryption based on hash function with only two-round diffusion process[END_REF], where the salsa20 hash function [START_REF] Hernandez-Castro | On the salsa20 core function[END_REF] is used to generate a dynamic secret key. Then, the resultant key is correlated later with the plain text image. Unfortunately, hash functions use floating calculation which makes the hardware implementation complicated and time consuming. Besides, using the pixels of the image itself will raise the probability of the error propagation. In other words, any small error caused by noisy channels (like wireless channels) will prevent the receiver from decrypting the image, thus making this system weak and intolerant to any small error.

To the best of our knowledge, a real, efficient and secure encryption algorithm is needed to meet the requirements of the modern multimedia applications and low cost devices. Therefore, an efficient and secure candidate that can ensure a high level of security with a low computational complexity and simple hardware implementation is necessary for recent applications such as multimedia IoT.

Contribution

The proposed approach ensures several contributions compared to the recent image encryption schemes towards attaining a high level of efficiency and security. These contributions are indicated in the following:

System performance

• The proposed cipher is realized on the block level with a flexible size of blocks (n bytes) that can be adjusted according to the available memory, thus allowing it to be realized with tiny limited devices.

• It is simple to implement in hardware or software solutions which is an important advantage to be considered in real implementations.

• The required processes are reduced for each round iteration from two (mainly substitution then diffusion) to only one process compared to the majority of encryption schemes. In fact, the diffusion operation is applied in the first round, while the substitution operation is realized in the second round. This permits to reduce the required latency for each round.

• A binary diffusion operation is proposed, in addition to an integer one. More important, the binary diffusion permits to reduce the execution time according to the obtained results (see page 13) from 17% to 45% in function of n (dimension of the diffusion matrix).

• Efficient key dependent cryptographic primitives (a substitution table, a diffusion matrix, and a permutation table) are built to ensure a considerable cryptographic performance and can prove to be a real improvement in time and simplicity. This will reduce the required time needed to build these cipher layers and will simplify the hardware implementation. This is essential, since each primitive of these three has its effect and its role in making the proposed cipher scheme secure and efficient.

• In addition, the proposed algorithm ensures the avalanche effect with an acceptable trade-off with error propagation.

Security performance

• The proposed cipher scheme presents an efficient collaboration between substitution, diffusion and block permutation towards ensuring a high level of security and efficiency.

• A block permutation operation is introduced to randomize the sequential order of chained blocks. This operation permits to complexify the procedure of possible future attacks and consequently ensures a better security level compared to the existing cipher approaches that preserve the encryption sequential order. In addition, this step requires lower latency overhead and will not degrade the previous performance contributions.

• The dynamic key approach is employed and the key can be changed for each fixed/chosen time (defined by an application or a user) or for each input image which will render the cryptanalysis task unfeasible. The attacker's task becomes more difficult because of the sensitivity of the unpredicted dynamic key especially if this dynamic key is changed for each input image. This will permit to ensure a high level of security against existing and modern powerful attacks.

As a conclusion, the obtained results, in terms of performance and security, prove that the proposed approach is efficient and can ensure a high level of security compared to other recent image encryption algorithms that have static or dynamic structures. Therefore, the proposed cipher can be considered as a relevant cryptographic candidate since it ensures a positive balance between system performance and security level.

Organization

The paper will be organized as follows: Section 2 shows the derivation of the special parameters needed for encryption. Then, in Section 3 the proposed encryption and decryption schemes are explained to show how the cipher works. In Section 4, the main cipher layers of encryption are detailed. They rely on key dependent substitution layer, diffusion, and permutation. Then, the algorithm is tested under extensive performance evaluation and security analysis in Section 5 to prove the robustness and efficiency of this proposal. In Section 6, the security of this algorithm is discussed. Finally a conclusion summarizes the work and future works are mentioned in Section 7.

Key Derivation

In this section, the proposed key derivation function and its corresponding sub-keys generation scheme are presented and illustrated in Figure 1. In fact, the cipher layers are dynamic and are changed according to this set of sub-keys. The input of this step is a secret key K and a NONCE N o (different for each input image or a fixed time) that are Xored to produce a dynamic key DK. To ensure that a different DK is produced for each different input image, the SHA-512 cryptographic hash function is chosen and it is known that it has a high degree of collision. This will introduce better strength against any powerful attacks. This dynamic key DK is the basis to form the other required sub-keys as explained in the following.

• Secret Key K: It is a Secret Key shared only between both entities (transmitter and receiver). To provide better security, the symmetric secret key can be renewed after each periodic interval that is chosen depending on the application. Elliptic curve Diffie Hellman (ECDH) protocols can be a good candidate for this task.

• Nonce N o : This Nonce can be produced by a pseudo random generator. Each Nonce should be used only once and should be different for every input image (or session time). Two possible techniques of generation of Nonce can be proposed: i) generated by the emitter and transmitted in an encrypted form to the receiver by employing the secret key or by employing The i th block of encrypted image (without blocks permutation) q q=2 for binary Galois field and its equal to 8, 16, 32, 64 for integer Galois field the receiver public key. ii) The second method is to produce the Nonce at the emitter and receiver in a synchronized manner between both entities.

• Dynamic Key DK: The secret key K will be Xored with N o and its corresponding output is hashed by employing SHA-512 to produce the dynamic key DK, which corresponds to the MAC value and it has a 512 bit length. After this, DK key is split into four sub-keys {K p , K d , K s , K i } in a way that each one of them has 16 bytes (128 bit) length. These sub-keys are described in the following.

• Permutation sub-key K p : K p represents the first most significant 16 bytes of DK and it is used to produce a permutation table (P -box) that is employed during the blocks permutation process. In this solution, any key dependent permutation generation algorithm can be employed. The selection of GRP permutation algorithm [START_REF] Zhijie | Bit permutation instructions: Architecture, implementation and cryptographic properties[END_REF] is done according to its simplicity in hardware or in software implementation. To ensure that a P-box has a good cryptographic performance, GRP should be iterated for multi-iteration rp and for each iteration a control parameter register is required according to [START_REF] Noura | Lightweight, dynamic, and flexible cipher scheme for wireless and mobile networks[END_REF]. This logic continues in this paper and K p is used as a seed for the famous stream cipher RC4 to generate the required rp control parameter registers. Furthermore, RC4 is not used here in the context of a stream cipher which mixes the key stream with the input plain-text. In fact, this is different since RC4 is iterated with a dynamic sub-key. This will not introduce any weakness and will not degrade the security level. Indeed, RC4 is selected here since it has the simplest hardware and software implementation and, it is the fastest one. RC4 should be iterated for rp×nb 8 times to form the binary control parameters.

• Diffusion sub-key K d : K d represents the second 16 most significant bytes. K d is used also as a seed for the RC4 stream cipher to produce a sequence V A with lv = n 2 × n 2 × q bits length, where q represents the precision in bits. q is equal to 1 in the case of a binary diffusion matrix and 8 in case of the byte integer matrix. In addition, the diffusion is realized at the block level and each block has n bytes. This means that n is the dimension of the square diffusion matrix (number of bytes in a block). Therefore, RC4 should be iterated for nt = lv 8 times. After that, V A is reshaped into a square sub-matrix called A with size n 2 × n 2 , which is necessary to form the square diffusion matrix G. Moreover, G can be binary or integer. In order to reduce the complexity, a binary diffusion layer is more recommended than using other layers of diffusion such as Matrix Distance Separate (MDS) as in AES or hill cipher (invertible integer square matrix). More details are given in Section 4.

• Substitution sub-key K s :k s represents the third set of the 16 most significant bytes and it is employed to produce a dynamic substitution table (S-box). The proposed cipher can employ any key dependent substitution generation table algorithm. In fact, in this paper, a simple technique is used and it is based on the Key Setup Algorithm (KSA) of RC4, which represents its initialization step. The output of KSA is a substitution table that is employed as a dynamic S-box in the proposed approach.

• Initialization key (K I ): K I represents the first 16 least significant bytes of DK and it is hashed by employing SHA -512 [START_REF] Mcloone | Efficient single-chip implementation of sha-384 and sha-512[END_REF], which is an un-keyed cryptographic hash function. The output hash value has 64 bytes length and it is divided into two equal parts, each one has a 32 bytes length. These two parts are considered as two initialization vectors (IV 1 , IV 2 ) that are employed in the forward and backward chaining modes according to the proposed approach.

All the notations are shown in Table 1. These steps are enough to preserve high sensitivity since a little change in the dynamic key will lead to completely different parameters in the encryption process and this is proven in Section 5. The derivation of these parameters is illustrated in Figure 1.

The Proposed Cipher Algorithm

An input image (matrix form) is introduced to the proposed cipher and its size is r × c × p, where r is the number of rows, c is the number of columns and p is the number of planes (in gray scale P =1). The number of blocks of the image is padded if necessary to be divisible into nb complete blocks and each block consists of n bytes. In the rest of the paper, n will be set to 16 and can be changed according to the needed application and the memory space. The total number of blocks is nb where nb = r×c×p n .

Encryption Algorithm

The steps of the encryption algorithm are described briefly in this section and its structure is illustrated in Figure 2. The proposed scheme is based on a secret symmetric key that is shared between the entities of the communication system. This secret key is employed to produce a set of dynamic keys and each one is employed for one or for a set of input images. The proposed cipher is divided into two rounds and a final block permutation process. Moreover, a Forward and a Backward Chaining CBC mode are employed to reach the required cryptographic performance such as the avalanche effect in the whole image. In the first round, a linear binary diffusion process is done by using the previously mentioned diffusion matrix G (integer of binary). Whereas in the second round, a non-linear substitution operation and a global permutation are applied. To ensure high randomness and to increase the robustness of the system, pseudo-random chaining is added in both processes. Finally, global permutation will randomize the sequence of blocks as a final step and remove any relation between successive blocks. In the following, the forward and backward processes are explained.

Forward process

It is the first step of the encryption algorithm, and it starts from the block B 1 that should be Xored with IV 1 . Then, its corresponding output will be subjected to a diffusion operation that can be based on a binary or integer diffusion matrix G. The result will be T 1 and the following equation summarizes this step for i = {1, 2, 3, . . . , nb}:

T i = G (B i ⊕ T i-1 ) (1)
Where, T 0 = IV 1 , and represents the diffusion operation that can be represented as an integer multiplication matrix in case of the integer diffusion and binary matrix mixing as described in Algorithm 2 for the binary diffusion operation. In this step, the diffused blocks are chained in a forward way and the process continues till the final block B nb is reached.

Backward process

The backward process starts after finishing the forward process. Starting from the last diffused block T nb , it is Xored with IV 2 that represents the second initial vector. Then, its corresponding output will be subjected to a substitution operation that is based on the produced substitution table S-box. The result will be C nb and the following equation summarizes this step for i = {nb, nb -1, . . . , 2, 1}:

C i = S (T i ⊕ C i+1 ) (2)
Where C nb+1 = IV 2 , and S represents the produced dynamic S-box. Then, the following block will be subjected to the same process, but with a difference that IV 2 will be replaced by IV 1 and with a reverse order. This means that in this step, the diffused blocks are chained in a backward way and the process continues until the first diffused block T 1 is reached.

Blocks permutation

After that, the output blocks {C 1 , C 2 , . . . , C nb } are subjected to a final block permutation operation. The permutation process is introduced to add randomness and to eliminate the sequential relation order among the diffused substituted blocks. Finally, permuted blocks will be reshaped into the original size of the matrix to form the encrypted image.

Decryption

Similarly to the encryption scheme, the decryption scheme consists of an inverse block permutation process using the inverse P -box called P -box -1 . In addition, the corresponding two rounds are applied in a reverse order by using the corresponding inverse dynamic substitution table S-box S -box -1 and the inverse diffusion matrix (G -1 ).

As a conclusion to this section, this cipher is designed to ensure the main properties that a strong secure cipher must reach. The confusion and diffusion properties are achieved with a lower round number and fast execution time and a high level of security as validated in the coming sections.

Proposed Cipher Layers

According to the theorem of Shannon, a successful cipher should achieve the confusion and diffusion properties. Mainly, the majority of the existing standard cryptographic algorithms is based on static keys. However, until now, no standard block cipher based on the dynamic approach is proposed and standardized. In fact, the benefits of the dynamic structure are important and we believe that the modern structure of cryptographic algorithm should be dynamic. Therefore, we follow this logic and this paper is a first step towards our goal. Thus, the proposed cipher is based on a dynamic key and it is designed to be a primary step towards standardizing it as a dynamic block cipher. The objective of this paper is to explain that it is possible to define a cipher with a high security level and with a lower computational complexity.

The dynamicity is reached since all the cipher operations (layers) are variable and depend on the dynamic key as the substitution, diffusion and permutation. The dynamic key can be changed for every input image which ensures the maximum level of security. Another configuration can be realized using DK for a fixed time that means for a set of input images. This means that for a specific session time, DK is not changed. In both scenarios, the dynamicity prevents any powerful attack or prevents getting any useful information from the collected plain and cipher images.

Proposed Diffusion Technique

Mainly, the diffusion operation, whether integer or binary, requires an initial step which is the construction of the invertible diffusion matrix G. In this paper, an integer and binary technique to build a diffusion matrix G is proposed. The main algebraic rule for a successful diffusion matrix G is to be an invertible matrix with a determinant equal to 1 and has to have full rank.

G is based on an invertible and bijective 2D matrix form. It is represented as follows:

a b c d , det(A) = a × d -b × c (3) Then, if det(A) = 1 ⇒ a × d = 1 + b × c.
To obtain the proposed structure of invertible key dependent diffusion matrix, we consider that d should be equal to a, which leads to

a 2 = 1 + bc ⇒ bc = a 2 -1 = (a -1)(a + 1).
This results in b and c being equal to (a + 1) and (a -1), respectively. Then, the form of the secret matrix will become in 2D as follows:

G = a a + 1 a -1 a (4)
In the following, the dimension of diffusion matrix can be extended to n dimension for integer and then for binary one, which is a special case of the integer one. In fact, the benefit of the binary diffusion operation compared to the integer one is its simplicity in implementation in hardware or software in addition to a lower execution time.

Integer diffusion matrix form

It is obvious that only one parameter a is needed to build G. To form the diffusion matrix G with n dimension, a is replaced by a sub-matrix A with size n 2 × n 2 as presented in the following equation:

G = A A + I A -I A ( 5
)
Where I is the identity matrix and A is a non-zero square matrix of size n 2 . The elements of A can be freely chosen from any Galois field ( Binary or integer) such that G is full rank.

To validate that the proposed diffusion matrix G is invertible, the following demonstration is presented.

Suppose that G is built from four sub-matrices (A, B, C, D) as shown in:

G = A B C D (6)
Its determinant is given by:

det(G) = det(A) × det(D -CA -1 B) (7) = det(A) × det(D -CBA -1 ) = det(A) × det(A -A 2 A -1 + I 2 × A -1 ) = det(A) × det(A -A + A -1 ) = det(A) × det(A -1 ) = det(A × A -1 ) = det(I) = 1
where

C × B = (A 2 -I 2 ), A 2 × A -1 = A and A -1 I 2 = A -1
. Thus, the basic condition is verified and an inverse matrix G -1 can be easily calculated at the receiver side according to the following equation.

Binary diffusion matrix form

The diffusion process in the binary Galois Field requires to employ a binary diffusion matrix G which enables to reduce the required computational complexity and can consequently reduce the execution time. Here, the scheme of creation of the invertible pseudo-random binary G is described.

To obtain the diffusion binary matrix form, the sub-matrix A should be binary and we need to replace the operation of addition and subtraction with the logical operation Xor. Then, the form of the binary matrix is presented below:

G = G -1 = A A ⊕ I m A ⊕ I m A (9)
According to [START_REF] Robert S Ledley | The inverse of a boolean matrix[END_REF], the calculation of the inverse binary matrix G is possible while the determinant of the binary matrix is 1 which is reached with the defined binary diffusion matrix form. Moreover, the proposed form has another advantage which is G -1 is equal to G, so the inverse matrix operation at the receiver side is not required and the same required latency of diffusion is close to the inverse diffusion one.

In Figure 3, two examples of the different steps required to build the secret diffusion matrix G (Integer and Binary) for n = 8 are presented. In Figure 4, a visual integer matrix G (a) and a binary one (b) are shown respectively for n=32. While for the visual binary G, the red color means that the index is equal to zero and 1 otherwise. As seen in Figure 5, a block can be diffused in two different ways: (a) using the integer diffusion operation that employs arithmetic operations such as addition and multiplication mod 2 q , and (b) using the binary diffusion operation that requires only the logical operation XOR.

Binary Diffusion Matrix Mixing Operation

The input of the diffusion operation is n bytes. The diffusion process is performed on a series of n bytes B = {B 1 , B 2 , . . . , B n }, and its output is the diffused block X = {X 1 , X 2 , . . . , X n }. The relationship among an input block B of n bytes, a binary diffusion matrix G and the output block X can be described as follows:

X = G (B t ) (10)
Where B and X are n-dimensional byte vectors and t is the transpose function. In addition, G is a square n × n binary matrix and it consists of n diffusion vectors {G 1 , G 2 , . . . , G n }. Each binary diffusion vector G i is represented as a sequence of independent random numbers from a binary Galois field, where G i,j is a binary diffusion coefficient of the line i and column j and i, j = 1, 2, . . . , n and can be equal to 0 or 1. This means that if G i,j is equal to 0, its corresponding byte j is not introduced in the diffusion process of the i th diffused byte.

The values of the different indexes in each vector (G i ) equal to 1 correspond to the byte introduced in the diffusion process. The diffused byte is the result of m xoring bytes, where the corresponding index of its diffusion vector is 1. The following listing shows the mixing algorithm ( ) in pseudo code in Algorithm 2.

The average of the execution time for the diffusion operation is done for 250000 iteration and for different sizes of block n using "GCC" with optimization "O2" for the proposed integer and binary diffusion techniques. Therefore, the ratio between their execution times is shown in Figure 6. The obtained results indicate that the binary if G i,j = 0 then approach can ensure a reduction in execution time compared to the integer one from to 17% to 45% in function of n. More important, increasing n permits to reduce more and more the execution time. This proves that the proposed binary approach is significant since it permits to reduce the execution time and consequently less latency and resources can be achieved compared to the integer diffusion operation.

z i ← (z i + G i,j × y j ) mod

Key Dependent Substitution Operation

An important property that should be ensured during the design of a cipher system is the confusion property which is ensured by employing a substitution technique that is a non linear operation. This operation makes the algorithm immune against differential and linear attacks. The existing substitution techniques use a lookup table called an S-box or employ a nonlinear function.

In this paper, the selected technique is to use a dynamic S-box that can ensure a lower latency compared to other ones. The proposed algorithm of construction dynamic S-boxes is based on the KSA of RC4. Moreover, the KSA algorithm is stated and explained in Algorithm 3. The cryptographic performance (LPF (Linear Probability Approximation Function), SAC( Strict Avalanche Criterion), BIC (Output Bit Independence Criterion) and DPF (Differential Probability Approximation Function)) of the produced substitution table is quantified after using each element of the substitution key K s . The corresponding results are shown in Figure 7 and clearly indicate that a good performance has been reached attained such as lower LPF, lower DPF, SAC and BIC are close to the ideal value=0.5. In addition, the produced S-box is bijective which consequently means that the inverse S-box, S-box -1 can be obtained. Hence, it can be generated easily by the following operation S-box -1 [S-box(i)]=i. Indeed, these criteria are explained briefly in the following.

• LPF: Quantifies the nonlinear degree of a given substitution table and it must be as low as possible. The variation of LPF versus the size of sub-substitution in byte length is shown in Figure 7-a. LPF is so stable and close to the minimum value from the third iteration (LPF close to 2 -4.8 ).

• DPF: Quantifies the differential uniformity of a given substitution table. It must reach its minimum value and in our case it reaches the minimum in a stable value after 3 iterations according to Figure 7-b.

• SAC: A S-box satisfies SAC whenever a single input bit is complemented, the output substituted bit should be changed at least with a probability of half. According to Figure 7-c, the SAC is attained and becomes close to its ideal value (0.5) from the third iteration.

• BIC: Specifies that two output bits j and k should be changed independently when a single input bit i is changed. It can also be seen that BIC reached its desirable value 0.5 after two iterations according to Figure 7-d.

According to all these criteria, the produced dynamic S-box achieves a good cryptographic performance from the third iteration. However, to ensure a high number of unique S-boxes, the size of the dynamic substitution sub-key K s is set to 16 bytes (16 iterations and for each iteration a byte is selected) in order to reach this objective.

Key dependent Permutation Layer

This step consists in applying a block permutation among the diffused substituted blocks. It is designed to remove and to randomize the order relation of blocks. The block permutation operation is performed by using the produced dynamic P -box that has nb length. This permutation table is built based on the GRP permutation algorithm that is described in [START_REF] Zhijie | Bit permutation instructions: Architecture, implementation and cryptographic properties[END_REF].

Algorithm 3 KSA for RC4 1: procedure Rc4 KSA(K = {k 1 , k 2 , . . . , k L }, L) 2:
for i ← 0 to 255 do 3:

S [i] ← i 4:
end for 5:

j ← 0 6:
for i ← 0 to 255 do GRP is chosen here since it is known to be simple and efficient in hardware and software implementations. The pseudo-code of GRP algorithm is shown in algorithm 4. The basic idea of GRP is to split the indexes into two groups according to a pseudo random bit sequence which is CR. If the bit in CR is 0, this index is placed in the first group. Otherwise, the element is placed in the second group. These three vectors have the same length, which will be equal to the number of blocks nb of the image. For further details about the permutation construction and realization, we can refer to [START_REF] Noura | Hldca-wsn: Homomorphic lightweight data confidentiality algorithm for wireless sensor network[END_REF] that describes GRP with variable control registers.

Statistical Analysis

In order to have a strong immunity against statistical attacks, histogram and entropy analysis are performed to validate the uniformity property of the encrypted image. The correlation among the adjacent pixels of the plain and encrypted images in addition to the coefficient correlation between plain and encrypted images is also computed to check the independence property. These properties allow us to validate that the proposed cipher can ensure a high degree of randomness.

Histogram Analysis

A uniform histogram for the encrypted image is necessary to ensure that this cipher meets the uniformity property. This means that each symbol has an occurrence frequency close to r×c×p n , Algorithm 4 GRP permutation algorithm 1: procedure GRP(R src, CR, l)

2: j ← 0 3:
If the control register bit is zero, put its corresponding index on the left 4:

for i ← 0 to l -1 do 5:

if

CR[i] == 0 then 6:
R dest

[j + +] ← R src[i] 7:
end if

8:
end for

9:

After that, if the control register bit is one, put its corresponding index on the right 10:

for i ← 0 to l -1 do 11:

if

CR[i] == 1 then 12:
R dest

[j + +] ← R src[i] 13:
end if

14:
end for

15:
R dest is the output substitution vector 16:

Return R dest 17: end procedure

(a) (b) (c) (d) (e) (f) (g) (h)

Information Entropy Analysis

The information entropy of a data sequence m is a parameter that measures the level of uncertainty [START_REF] Zhang | A novel image encryption method based on total shuffling scheme[END_REF]. Note that the entropy is expressed in q bits and it quantifies the amount of information which can be coded by a compression algorithm. The information entropy is calculated according to the following equation:

H(m) = - 2 q i=1 p(m i ) log 2 1 p(m i ) (11)
Where p(m i ) represents the occurrence probability of the symbol m i and 2 q is the total number of symbols for q bits. In this paper, towards quantifying the uniformity between adjacent pixels, the entropy is selected to be calculated on the level of sub-matrix.

This test divides the image into a set of sub-matrices, where each one has a size h × h. Each sub-matrix can be considered a truly random source with uniform distribution if it has an entropy equal or close to log 2 (h 2 ) for h 2 < 2 q .

H(m) = - h 2 i=1 1 h 2 log 2 1 h 2 = log 2 (h 2 ) ( 12
)
The entropy variation of plain and cipher sub-matrices of the Lena image under the usage of a random secret key and a Nonce for h = 8 is shown in Figure 9. It is shown that the encrypted blocks always have an entropy close to the desired value 6 (log 2 (8 × 8) = log 2 (2 6 ) = 6) in case h = 8. According to this, the proposed cipher ensures the uniformity and eliminates the redundancy between adjacent pixels.

Test Correlation between Original and Cipher image

The high linear correlation between adjacent pixels must be removed after encryption which is a mandatory principal to resist statistical attacks [START_REF] Norouzi | A novel image encryption based on hash function with only two-round diffusion process[END_REF][START_REF] Rhouma | Cryptanalysis of a new image encryption algorithm based on hyper-chaos[END_REF]. Having a correlation coefficient close to zero means that the cipher scheme ensures a high degree of randomness. The correlation test is realized by randomly taking N = 2, 000 pairs of two adjacent pixels of the defined known two plain images and their corresponding cipher images. Correlation is done in three directions: horizontal, vertical and diagonal. The correlation coefficient r xy is calculated using the following equations:

r xy = cov(x, y) D(x) × D(y) (13)
where

E x = 1 N × N i=1 x i D x = 1 N × N i=1 (x i -E(x)) 2 cov(x, y) = 1 N × N i=1 (x i -E(x))(y i -E(y))
The obtained results for both encrypted images (Lena and pepper) are presented in Figure 10. The obtained results indicate that the correlation coefficients of a plain image in horizontal, vertical and diagonal direction are higher and close to 1 where it is very low and close to 0 for the ciphered images. This shows that the proposed cipher scheme eliminates spatial redundancy.

(a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l)

Difference Between Plain and Ciphered Images

The encrypted image must be different by at least 50% from the original image in the bit level. Figure 11-a shows the variation of the percentage of bit difference between the plain and cipher Lena images for 1, 000 random dynamic keys. According to this result, the obtained value of the percentage difference is always close to 50%, which means that the proposed cipher scheme ensures the independence. This test, in addition to the previous ones, validates that the proposed cipher ensures a high randomness degree.

Sensitivity Test

Differential attacks are based on studying the relation between two encrypted images resulting from a slight change, usually one bit difference compared to the original one. A successful sensitivity test shows how much a slight change in the original-image or in the key will affect the resulted cipher image. The higher the encryption change, the better the sensitivity of the encryption algorithm is proven. There are two types of sensitivity: a Plain Sensitivity (P S) and a Key Sensitivity (KS). A key sensitivity shows how much the plain image is affected by a one bit change in the key. The result must be a change with at least 50% in the ciphered image. In Figure 11-b, the key sensitivity versus 1,000 random keys is always close to the optimal value (50% ). This indicates that any little change in the dynamic key will certainly affect the ciphered image.

Concerning plain-text Sensitivity, a dynamic key is used and the avalanche effect of the cipher is tested. One bit in two plain images is changed and it is clear that the images differ by at least 50%. Indeed, the obtained two ciphered images are totally different as illustrated in Figures 11-c where plain sensitivity was tested for 1,000 random dynamic keys. The cost of reducing the number of rounds and latency is given, since some values are far from 50% but still in an accepted manner. Therefore, the cipher has successfully met the avalanche effect and is considered to have enough sensitivity against any change in the plain image. In addition to that, the sensitivity of the deciphered images is also tested. Changing one bit in the decrypted images must lead into a different image from the original one. The difference test between two decrypted images is done with the LSB bit of a chosen byte changed in the ciphered image. The result obtained is at least 50% different deciphered image. Then, the proposed algorithm has also a deciphering sensitivity. The result is shown in Figure11-d. Note that in Figure 11, all the results are obtained with a binary diffusion matrix. The results are similar using an integer diffusion matrix.

Approach of [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] Min [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] and of the proposed scheme by using the integer diffusion matrix for 1000 random keys with Lena as plain image. In fact, a statistical comparison between the proposed scheme with integer diffusion operation and the approach of [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] is presented in Table 2. Based on the obtained result, we can conclude that the proposed approach achieves a similar cryptographic performance compared to [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF]. In addition, in Table 3, a statistical cryptographic performance of the proposed approach with a binary diffusion operation is presented. Also, the obtained results are similar to [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF]. This indicates that the binary diffusion operation preserves the required cryptographic performance and consequently it can be safely employed in the proposed cipher.

Visual Degradation

This test is specific for image and video contents and enables to quantify the visual degradation reached by employing the cipher scheme. In fact, the degradation operated on the encrypted image prevents the contents of an image from being recognized. To measure the visual degradation, a well known parameter is studied to measure the encryption visual quality, which is the Peak Signal-to-Noise Ratio (PSNR) [START_REF] Huynh | Scope of validity of psnr in image/video quality assessment[END_REF].

Indeed, PSNR is derived from the Mean Squared Error (MSE), which represents the cumulative squared error between an original and encrypted image. A lower PSNR value indicates that there is a high difference between the original and the cipher images. In the proposed algorithm PSNR was measured between the original and the encrypted image for 1, 000 random dynamic keys and is presented in Figure 12. As shown, the mean PSNR value is 8.621 dB, which is close to the desirable value. This low value validates that the proposed encryption technique provides a high difference between the original and the encrypted image. As a conclusion, the proposed cipher scheme ensures a hard visual degradation so that no useful information can be revealed about the contents of the original image from the ciphered image.

Propagation of errors

Error propagation is an important criterion that should be low (error is not propagated) to consider the proposed cipher as efficient. Interference and noise existing in the transmission channel are the main causes of error. However, a bit error means that a substitution of '0' bit into '1' bit or vice versa will take place. In the proposed algorithm, if any block is affected in an image, it will only affect its previous and next neighboring blocks. This presents an acceptable error propagation. In fact, this is the cost of ensuring the avalanche effect in the whole image.

Execution Time

The main motivation of this paper is to design a lightweight cipher scheme that can reach the required level of security, with a lower execution time, and respect the time limitations of real time and reduce the required resources. In fact, a lower time of execution leads to a lower energy consumption of calculation, which is critical for limited devices that use a battery. The average calculation time (within 1, 000 iterations) to encrypt the plain Lena image of size 256 × 256 × 3 is performed using the following software and hardware environment : Matlab R2013b simulator, micro-computer Intel Core i5, 3 GHZ CPU, 2 GB RAM Intel and the Microsoft Windows 7 operating system.

A comparison in execution time is done with the recent algorithm of [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF], which was compared with recent cipher schemes and indicates that it can ensure a lower execution time compared to the selected recent state of the art. The average of the execution time for 1,000 iterations and for different sizes of block n is obtained for the proposed approach (integer diffusion operation) and for [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF]. Therefore, the ratio between the execution time of the proposed cipher and of [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] is shown in Figure 13. In addition, the linear interpolation of the variation of ration versus n is also calculated, and it is shown in Figure 13-a and presented in the following equation: Ratio = -0.0013253 × n + 0.76247 [START_REF] Huang | Implementation of gray image encryption with pixel shuffling and gray-level encryption by single chaotic system[END_REF] According to this result, the proposed approach ensures a reduction in execution time from to 22% to 26% in function of n compared to [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF]. In addition, increasing n permits to reduce more and more the execution time. This proves that the proposed scheme requires a lower execution time and consequently less latency and resources compared to [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF]. Consequently, the execution time of the proposed cipher is lower compared to [START_REF] Mohammad Seyedzade | A novel image encryption algorithm based on hash function[END_REF][START_REF] Huang | Implementation of gray image encryption with pixel shuffling and gray-level encryption by single chaotic system[END_REF][START_REF] Kumar | Extended substitution-diffusion based image cipher using chaotic standard map[END_REF][START_REF] Shahram | Chaotic image encryption system using phase-magnitude transformation and pixel substitution[END_REF][START_REF] Tong | A new feedback image encryption scheme based on perturbation with dynamical compound chaotic sequence cipher generator[END_REF][START_REF] Norouzi | A novel image encryption based on hash function with only two-round diffusion process[END_REF][START_REF] Zhang | A novel image encryption method based on total shuffling scheme[END_REF][START_REF] Zhu | A novel image encryption scheme based on improved hyperchaotic sequences[END_REF]. On the other hand, in Figure 13-b, the ratio of the execution time of each operation of the proposed approach is presented. The obtained result indicates that the diffusion operation requires the higher percentage of execution time in function of n. Moreover, employing the binary diffusion operation will permit to reduce more the execution time according to Figure 6. Therefore, and according to the previous results, the execution time is reduced to 50% for n ≥ 16 by employing the binary diffusion operation compared to [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF].

(a) Ratio between the proposed approach and of [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] (b) Ratio of the employed cipher operation Figure 13: (a) the ratio time analysis between the proposed approach and the one in [START_REF] Fawaz | An efficient and secure cipher scheme for images confidentiality preservation[END_REF] in function of n and for 1000 iterations and (b) the ratio of each operation (integer diffusion, substitution, and blocks permutation) of the proposed approach.

6 Discussion and Cryptanalysis: Resistance against the well-known types of attacks

All the previous tests were carried out to prove that the proposed scheme is efficient. In this section, a brief cryptanalysis discussion is presented to validate its secure employment and to prove that it can resist the different kinds of existing attacks. Uniformity was proven by getting the histograms of the ciphered images and by applying the entropy analysis. Then, independence between plain and cipher images is verified based on the correlation test among the adjacent pixels and between the original and cipher images in addition to measuring the difference in bit level between the plain and cipher images, which is close to 50%. Therefore, the encrypted images ensure a high degree of randomness and consequently provides it with a high resistance degree against statistical attacks.

The sensitivity of the plain image is accomplished with an acceptable value (always > 45) and the avalanche effect is reached in the whole image. A small reduction in terms of avalanche effect is introduced towards reducing the execution time. However, this will not degrade the security level since the lower value of plain image sensitivity is always greater than 45%. Therefore, any change in any bit of the plain image will provide a different deciphered image.This in turn will prevent chosen/known plain/cipher image attacks.

The sensitivity of secret and dynamic key in addition to a Nonce is attained and any change in any bit of these parameters provides a different cipher image on the emitter side or a different decrypted image on the receiver side with a 50% changed, which is a very satisfying result. These results validate that the proposed scheme can resist the related key attacks.

On the other hand, the size of the secret key can be 128, 196, and 256 bits as AES and the size of the dynamic key and Nonce are 512 bits, which are sufficient enough to protect the proposed cipher against the brute force attacks. More important, the proposed dynamic key approach played a massive role in making this scheme more secure compared to the existing and modern powerful attacks. In addition, the variation of the secret key permits to overcome the problem of accident key disclosure. This discussion will enable the proposed cipher to be considered as a good candidate for lightweight modern image encryption.

Conclusion

Our aim was to ensure a better security level and to meet the limitations of modern multimedia applications and low cost devices that are used today with limited resources. Therefore, the objective of this paper is to propose an efficient and robust lightweight cipher candidate that can ensure lower latency for the real time applications and to reduce the required resources for the low cost devices.

In contrast with the existing image encryption ciphers, the proposed scheme uses the substitution and diffusion only once but in two different rounds towards reducing the required latency and resources and without any degradation in the level of security.

In this paper, the proposed cipher is based on the dynamic key approach which permits to produce a dynamic key for each validate time (session) or for each input image (depending on the configuration). Then, based on this dynamic key, a set of sub-keys are obtained to produce the required dynamic initialization vectors, substitution and permutation tables in addition to a diffusion matrix, which are the basic elements of the proposed dynamic cipher scheme. Furthermore, the structure of the proposed cipher employs two different round functions using the CBC operation mode in forward and backward directions. After that, a block permutation operation is applied to randomize the sequential order of blocks. This operation permits to complicate the procedure of possible future attacks. Furthermore, the first round employs a dynamic diffusion operation that can be an integer or binary, while the second round uses a substitution operation. Therefore, both rounds permit to ensure the confusion and diffusion properties. In addition, the advantage of employing the CBC with forward and backward directions is to achieve the avalanche effect in the whole image.

Extensive tests were done to prove that the proposed candidate ensures the desired cryptographic performances. As a conclusion, due to its flexibility, high security as well as fast execution time achieved, it can be considered as a good cipher candidate. This cipher can compete with the available image cryptographic algorithms that can ensure image data confidentiality and privacy in real implementations for modern applications.

Figure 1 :

 1 Figure 1: Dynamic Key and the requires sub-keys generation scheme. These sub-keys are employed to form the cipher layer's.

Figure 2 :

 2 Figure 2: Scheme of the proposed lightweight cipher algorithm.

Figure 3 :

 3 Figure 3: An example of constructed secret integer (a) and binary (b) matrices G for n = 8.

  Integer diffusion matrix (b) Binary diffusion matrix

Figure 4 :

 4 Figure 4: A visual example of a produced secret matrix G in a binary field (a) and in an integer field (b) with a pseudo random sub-matrix A for n =32.

  (a) Integer diffusion operation (b) Binary diffusion operation

Figure 5 :

 5 Figure 5: Integer (a) and binary (b) diffusion operation to produce a diffused element X i by employing the i th vector G i of the diffusion matrix G.

Algorithm 2

 2 Integer & Binary Diffusion Algorithm 1: procedure Integer Mixing(Y, G i )

  256

  return z = {z 1 , z 2 , . . . , z n } 10: end procedure 1: procedure Binary Mixing(Y, G i )

  return z = {z 1 , z 2 , . . . , z n } 12: end procedure

Figure 6 :

 6 Figure 6: The ratio time analysis between the proposed binary diffusion approach and of the integer one in function of n and for 25 0000 iterations.

7 :j

 7 ← (j + S[i] + k[j mod L]) mod 256

Figure 7 :

 7 Figure 7: Variation of the average LP F (a), DP F (b) , (c) SAC, (d) BIC versus the number of iterations i.

Figure 8 :

 8 Figure 8: (a) Original Lena (a) and Pepper (e) and its corresponding histogram (b) and (f), respectively. Encrypted Lena (c) and Pepper (g) and its corresponding histogram (d) and (h), respectively.

Figure 9 :

 9 Figure 9: The Entropy analysis for the sub-matrices of encrypted Lena image under the usage of a random dynamic key for h = 8 and (b) a zoom of the entropy of the encrypted image. Ent-OB and ENT-CB are the entropy of the plain and cipher sub-matrices, respectively.

Figure 10 :

 10 Figure 10: Correlation in adjacent pixels in original Lena: (a) horizontally, (b) vertically and (c) diagonally. Correlation in adjacent pixels in ciphered Lena:(d) horizontally, (e) vertically and (f) diagonally.

Figure 11 :

 11 Figure 11: (a) Difference between plain Lena and ciphered (Dif ), (b) Key Sensitivity (KS), (c) Plain Sensitivity (P S) and (d) Cipher Sensitivity (CS).

Figure 12 :

 12 Figure 12: P SN R variation between the original and the encrypted Lena image versus 1000 dynamic keys

Table 1 :

 1 Table of notations

	Notation	Definition
	K	Secret key
	N o	Nonce
	DK	Dynamic Key
	K p	Permutation sub-key
	K d	Diffusion sub-key
	K s	Substitution sub-key
	K I	Initialization vectors sub-key
	S -box	A dynamic produced substitution table
	S -box -1 The inverse corresponding substitution table
	P -box	A dynamic produced permutation box
	P -box -1 The inverse corresponding permutation box
	G	A dynamic diffusion matrix (Integer or binary)
	G -1	The corresponding inverse diffusion matrix (Integer or binary)
	r	Number of rows of the input image
	c	Number of columns of the input image
	p	Number of planes of the input image
	n	Number of bytes in one image block (n=4, 8, . . . , 32)
	nb	Number of blocks in corresponding image
	B i	The i th block of plain image
	C i

Table 2 :

 2 Statistical results of

						Proposed Approach with "integer" Diffusion matrices
			Mean	Max	Std		Min	Mean	Max	Std
	Dif	49.8875 50.001	50.12	0.034	Dif	49.9414 49.9998 50.0677 0.0195
	P S	45.6381 48.0975 50.9305 1.9728	P S	45.4594 49.9533 53.9893 1.0992
	KS	49.8741 49.9993 50.1143 0.0342	KS	49.9398 50.0003 50.0666 0.0198
	H -O 2.1823	4.2014	5.7813	0.79914	H -O 2.1823	4.2014	5.7813	0.79914
	H -E 5.7623	5.7657	5.7701	0.0012	H -E 5.7566	5.7658	5.7743	0.0024
	PSNR 9.1919	9.2306	9.2604	0.0096	PSNR 8.5720	8.5896	8.6054	0.0054

Table 3 :

 3 Statistical results of the proposed scheme by using the proposed binary modification for 1000 random keys with Lena as plain image.

	Proposed approach with "binary" diffusion matrices
		Min	Mean	Max	Std
	Dif	49.941	50.0007 50.0623 0.0202
	P S	44.9621 50.041	55.131	1.185
	KS	49.9439 49.9992 50.0651 0.0199
	H -O 2.1823	4.2014	5.7813	0.79914
	H -E 5.756	5.7657	5.775	0.00239
	PSNR 8.573	8.5894	8.6093	0.0054

Acknowledgement

This paper is partially supported with funds from the Faculty of Engineering and Architecture at the American University of Beirut and also from the Labex ACTION program (contract ANR-11-LABX-01-01).