1 Introduction

Information security has become the part and parcel of today’s world. Images are the most common form of multimedia on the internet. Security has become one of the most important issues during the transmission of information over the network. The main aim of cryptography is to convert the information to be kept confidential into an unrecognizable content by encryption so that only the authorized persons can have the ability to recover the original data without losing anything important. An eavesdropper finds it impossible to decipher the encrypted message or image. The cipher image obtained after encryption has no relevance to the original image without decryption. Images have some special properties that makes them different from texts. These properties like high content, redundancy and high correlation among the adjacent pixels make the encryption process worth of a concern. An efficient image encryption algorithm should generate a random cipher image at a good speed [11].

In [13], the authors proposed a scheme based on two chaotic maps and XOR operation. The encryption technique includes two phases; one permutation and one substitution stage. In permutation circular shifts are used, each row of plaintext image is shifted circularly based on a number in a random matrix K1. So, the number of rotations are different for each rows. Then, the resulted image is shifted circularly column wise. For vertical rotation, every column is shifted circularly using numbers in a random matrix K2. The resultant matrix is XOR ed with a PRNS to obtain the encrypted image.

In [7], the authors has demonstrated the weakness of an chaotic map based color image encryption algorithm by successfully chosen-plaintext attack and chosen-ciphertext attack. In [16] a dynamic s-box based image encryption scheme is presented but performance and security of s-boxes for stream cipher should be compared with other schemes. In [5] the authors uses a Chebyshev chaotic map for generating a PRNS, based on the PRNS the bits are permuted first. It stores the 8 bit plains separately (assuming 8 bit gray level images), which results to handle a matrix of size 8times than the original image. For permutation, this scheme needs to sort the PRNS, which adds additional computational overhead of sorting the long chaotic sequence. In the second part the scheme permutes the bit plain again based on an Arnold’s cat map In the results the authors did not mention the number of rounds needed to achieve the results. As the scheme permutes the bit plains twice, it results a diffusion effect on encrypted image. But as permutation only ciphers are weaker to the cryptanalysis, the overall scheme becomes a high complexity and low in security scheme [10].

In [6], the authors have proved that any permutation-only encryption , of any structure, the plain image can be recovered completely by chosen-plaintext attack. They have success fully brocken the Fu’s scheme and Rahman’s Scheme. They need \(n= \lceil (\log _{L}(MN))\rceil \times (O(n.MN))\) number of plain images for a successful attack. Where M is number of rows and M is number of columns of the image.

In [3], the authors proposed an encryption scheme using chaotic map and genetic operations for Wireless Sensor Networks (WSN). The initial parameters are communicated using a secure channel or a key exchange protocol, which uses ECC over prime field for key establishment. For generating pseudo-random sequences, it uses N-logistic tent map. Genetic operations are used for encrypting the pixel values. However, it is found that genetic operations do not generate a quality encryption effect. Since this algorithm uses blocks of plaintext, it needs padding if the size of plaintext is less than the size of the predefined blocks. The whole encryption process is repeated for each block of the plaintext. Each of these blocks require 256 bit pseudo random bit sequence, which is independent of the sequence generated for the previous block. So, for a sufficiently large image as 512 × 512, the generation of sequence takes considerable amount of time. To achieve a fair encryption effect, the scheme takes n numbers of iterations, where n is the numbers of bytes in the block to be encrypted. The crossover operation is done repeatedly so that each byte in mutated plaintext performs the operation at least twice. Hence a higher value of n leads to exponentially high computational overhead.

In [2] the authors have presented an encryption scheme, which has four phases. This scheme starts with a diffusion phase, based on bitwise XOR operation and a new chaotic map followed by a substitution phase based on S-boxes. Further, a diffusion phase is added based on chaotic logistic map followed by a block permutation phase accomplished by a permutation MAP function. This algorithm is like using two chaos based algorithms in serial, which results a high computational overhead.

This paper presents a novel encryption scheme based on a HPRNG and genetic operations. The new HPRNG id designed based on Linear Feedback Shift Register(LFSR) and chaotic asymmetric tent map is used to generate the initial vector for the LFSR. The generated sequence is used to encrypt the image blocks by operations of XOR and genetic operations (mutation, and multipoint crossover). The first block of the plain image is encrypted with help of a pseudorandom bit sequence generated by the HPRNG. Therefore, the proposed scheme generates pseudorandom bit sequences of length 256 for one time, which reduces the computational overhead of generating a huge amount of PRNS generation. The subsequent blocks are based on the previous cipher block and the XOR operator followed by mutation and multipoint crossover operation, which need a low amount of computational cost. Hence the overall process remains a lightweight scheme and useable for WSNs. The scheme can be extended to color images and text as well. The cipher image produced has a very low correlation with the plain image and has high values of entropy, making it unpredictable and difficult to detect redundancies in the image pixel values. Further, the test results are compared with AES [12], Fu et al.’s Scheme [5], Li et al.’s Scheme [8] and Zhou et al.’s Scheme [17]. In most of the cases the proposed scheme demonstrate better performance than the existing.

In the next section (Section 2) the Preliminaries are discussed. In Section 3 the image encryption algorithm is presented followed by the experimental results and security analysis in Section 4. Finally the summary is given in Section 5.

2 Preliminaries

2.1 Chaotic logistic map

Logistic map is one of the simplest chaotic maps, described by (1) [4].

$$ \begin{array}{@{}rcl@{}} x_{k+1}&=&f(x)=\mu x_{k} (1-x_{k} )\\ &&\mu\in(0,4) ,x_{k}\in(0,1) \end{array} $$
(1)

when μ belongs in range (3.5699456,4), the map demonstrate chaotic behavior. The logistical map provides valuable characteristics like simple structure, extreme sensitivity to initial conditions.

For the logistic map, we have an equilibrium point at x0 = 1 − 1/μ. The derivative of f at that point is:

$$ \begin{array}{l} f^{\prime}(x_{0} )= \mu(1-2 x_{0})\\ =\mu(1-2(1- \frac {1}{\mu})) \\ = -\mu+2 \end{array} $$
(2)

Hence, \(|f^{\prime } (x_{0})|<1 if |2-\mu |< 1 \). Thus this equilibrium point is stable if 1 < μ < 3. It is unstable for μ > 3, and for μ < 1. So the “behavior” of the function changes at μ = 1 and μ = 3 which are called bifurcation points. The phase diagram of logistic map with initial condition μ = 2.0 and x0 = 0.5 is shown in Fig. 1.

Fig. 1
figure 1

The phase diagram of Logistic map with initial condition μ = 2.0 and x0 = 0.5

The Lyapunov exponent of Logistic map can be described as (3). It is plotted in Fig. 2 with initial condition x0 = 0.5 and control parameter μ = 3.99997. The calculated value of Lyapunov exponent is 0.690193 [9].

$$ \lambda (r; x_{0})=\lim\limits_{N \to \infty }{\frac{1}{N}}\sum\limits_{{i=0}}^{{N-1}}\ln |r(1-2 x_{i})| $$
(3)
Fig. 2
figure 2

The Lyapunov exponent of Logistic map

2.2 Linear feedback shift register

A linear feedback shift register (LFSR) is a shift register whose output acts as a feedback and as input for the next output. The inputs to the register depend linearly on the previous states as well. Exclusive-or is the most frequent linear function employed in LFSR. The initial state of the LFSR is termed as the seed. The output of the register is deterministic and completely depends on the previous states. A LFSR can generate a very long cycle with a random appearing sequence of bits, provided the feedback function and the tap positions are choosen well. In Fig. 3 A 32-bit LFSR is given.

Fig. 3
figure 3

A 32-bit LFSR

The output obtained from the shift register occurs in runs of zeroes and ones. As an example, the output bits 00111001 has four runs of lengths 2, 3, 2, 1, specified in the order of occurence. There occurs 2n− 1 runs in a complete period of a maximal LFSR, like a LFSR of 8-bit seed has 128 runs. Out of these runs, 50% are of length 1 bit, 25% are of length 2 bits, and up to a single run of length n − 1 bits of all 0’s, and a single run of length n − 1 bits of all 1’s [15].

The initial states of LFSR and the tap positions are choosen such that they generate approximately the equal numbers of ones and zeros with a shorter sequence of consecutive same bits. For the LFSR to be of maximal length, the number of taps should be even and the set of taps taken altogether must be relatively prime.

2.3 Genetic operations

2.3.1 Mutation

Genetic Mutation is the operation that introduces diversity from one generation to the next generation. The basis of genetic mutation lies in the biological mutation. It changes one or more genes from the current generation to obtain the next generation genes. The genes may even completely change as a result of mutation operation. This makes genetic algorithms (GA) achieve better genes by going through mutation process. Example of two random cromosom A and B are given below:

  • Cromosom A:

  • Cromosom A:

An cromosom may be encoded useing binary encoding, permutation encoding, value encoding, or tree encoding; Binary encoding is the mosr populer among them in which cromosomes are encoded in 0 and 1 binary string. In this data is represented in binary strings and then represented as cromosoms.

The main purpose of mutation in GAs is to preserve and introduce diversity. Mutation can result into different transformations in the bit sequence depending on its various types. It can be bit flip mutation, random setting, scramble or inversion as summerised in Table 1. The author has proposed to use inversion mutation to invert the bit sequence. The bits in each of the blocks are flipped left to right thereby significantly increasing the robustness and security of encryption as shown below example [3].

figure e
Table 1 Various types of mutations

2.3.2 Crossover

Crossover operations are generally performed over a single point, two points or uniform points as presented in Table 2. A single crossover point on both input parents bit sequences is selected in the case of single point crossover. All the bits following that crossover point in both the sequences is swapped between the two parent sequences to obtain the children sequences [3].

Table 2 Various ways of cross over

Multi-point crossover is performed by selecting two points on the parent sequences and swapping the bits between the two points in both the parent sequences to obtain two child sequences. In the proposed scheme, the two points are choosen on the basis of the number of zeros and ones in the bytes of generated random number. An example is shown in Fig. 4.

Fig. 4
figure 4

Two points for multipoint crossover 3rd bit and 6th bit

Mutation and crossover are used in genetic algorithms to generate diversity and produce newer genes from the existing genes.

3 Proposed scheme

3.1 Design of HPRNG

The hybrid PRNG is designed based on a 128 bit LFSR and chaotic maps. LFSRs are good option for PRNG, but there are several successful attacks on LFSR based PRNG, which reviles the secret key. To overcome these problems and generate high-quality random sequence an extra bit is XORed with the feedback of LSFR in every clock cycle. The extra bit is generated by an chaotic logistic map as presented in Fig. 5. Initial 128 bits for the LFSR circuit is called as initial vector (IV). To generate PRN using this hybrid PRNG, it needs two sets of keys, the initial parameters for logistic map and IV for for LFSR. The two sets of key together represented as K = {x0, μ, IV }. The tap positions are decided based on the polynomial b32 + b22 + b2 + b1 + 1. For the convenience of representation the above 32 bit implementation is presented in Fig. 5. However, for the encryption scheme presented here uses a 128 bit LFSR with feedback polynomial b128 + b127 + b126 + b121 + 1 for the HPRNG. The 128 bit LFSR has a key-space of 2127 − 1. The skew tent map is an optional to the HPRNG and it has no effect on the efficiency of the HPRNG. It is used as initial vector generator for the LFSR.

Fig. 5
figure 5

A 32 bit HPRNG

3.2 Design of the encryption scheme

The pixel values in the plain image is converted into binary bits and grouped into blocks of 256 bits each. These blocks are encrypted in multiple rounds. In each round, different operations are performed on each block of the image, consisting of 32 pixels. Each block requires a 512 bit sequence Ki for determining on which parts of the block, the specific operations will be performed. This Ki also determines Ki+ 1, which is used for the encryption of the next block in the image. The whole process is represented in Fig. 6

Fig. 6
figure 6

The proposed encryption algorithm

For each round, the encryption process occurs in following phases:

Initially an input image I is taken and divide I in \(n: n=0, 1, 2 \dots , n\) blocks of 256 bit each. Then generate 512 bit random sequence Sr using the HPRNG. The Sr is divided in in two parts, namely L0 and R0.

The ni block (256 bits) of the plain image are XORed with the 256 bits of left half (Li) of the generated sequence. The output obtained (Ri+ 1) serves the dual purpose in the encryption process.

Then it acts as the right half (Ri+ 1) of the random sequence for the next block. The generation of Ri+ 1 using ni and Ri makes the encryption process more secure due to the use of different random sequences for each block in each round of the encryption process.

As the pixels in a plain image are highly correlated, introducing mutation by flipping the bits left to right brings a drastic change in the pixel values, making the adjacent pixel bit representation completely different. This brings the required change in the pixel distribution in order to maximize the effects of multipoint crossover in the next step.

The genetic crossover operation brings about a change in the order of the bit sequence. This change is in relation to the adjacent bit sequences. In the multipoint crossover operation, each byte in the block is divided into three parts based on the count of 0s and 1s in Ri of the random sequence. The adjacent bits in the block are crossed over by swapping the first and the last parts of each byte. Genetic operations serve the major purpose of introducing and maintaining the reasonable amount of diversity in the bit sequence of the cipher image \(C=C_{0}C_{1} {\dots } C_{n}\). In the encryption process all the XOR operations are followed by genetic mutation and multipoint crossover process which adds benefits of confusion and diffusion. Therefore, the cipher will not be vulnerable to the chosen-plain-text attack and the encryption process remains strong.

4 Security analysis and experimental results

This part analyses the experimental results and the effectiveness of the proposed encryption. For the purpose of analysis images of different nature and sizes are taken namely lena image (512 × 517) in Fig. 7, barbara image (512 × 512) in Fig. 8, baboon image (512 × 512) in Fig. 9, Airplane image (512 × 512) in Fig. 10, pepper image (512 × 517) in Fig. 11, goldhill image (512 × 512) in Fig. 12, Finger print image (509 × 612) in Fig. 15, Text image (960 × 493) in Fig. 14, and Squares (600 × 517) in Fig. 13. Further, a color image is encrypted in Fig. 16 to test the capability of the scheme to encrypt color images. The results proves that the propose scheme is robust and applicable to any kind of image with capability of giving high security (Fig. 15).

Fig. 7
figure 7

Test the scheme on lena image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 8
figure 8

Test the scheme on barbara image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 9
figure 9

Test the scheme on baboon image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 10
figure 10

Test the scheme on peppers image to compare histogram of plain image and cipher image. a Test plain (pepper) image, b Histogram of plain image c cipher image, d Histogram of cipher image e cipher generated using method in Ref. [17] f histogram of cipher generated using method in Ref. [17]

Fig. 11
figure 11

Test the scheme on airplane image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 12
figure 12

Test the scheme on goldhill image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 13
figure 13

Test the scheme on Black and white square image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 14
figure 14

Test the scheme on text image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

Fig. 15
figure 15

Test the scheme on a biometric Fingerprint image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of plain image c cipher image, d Histogram of cipher image

4.1 Die hard statistical test of the HPRNG

The HPRNG is being tested with NIST cryptographic random number test suite, DIEHARD [1]. The HPRNG passes all the tests and shows hing randomness. The test results are given in Table 3.

Table 3 Die hard statistical test results

4.2 Histogram analysis

Histogram reflects the frequency of different pixel values present in the image. It is a must to have a uniform and flat histogram of a cipher image in order to forbid the evesdropper from gaining any beneficial statistical knowledge. The histogram of the encrypted images are plotted and analysed here. It shows that the histogram of the encrypted image is uniform which makes statistical attacks difficult. The original test images are shown in subfigure (a) in all Figs. 7 to 12, their corresponding histogram shown in subfigure (b), in each sub Fig. (c) the encrypted images are presented and corresponding histogram of encrypted images are shown in subfigure (c) in all Figs. 7 to 16. The histograms corresponding to cipher images are almost flat and uniform and contain nearly the same frequency of all intensity values. This shows that the encryption algorithm is efficient enough for encrypting images.

Fig. 16
figure 16

Test the scheme on lena color image to compare histogram of plain image and cipher image. a Test plain image, b Histogram of color image c cipher color image, d Histogram of cipher color image

4.3 Key space analysis

The method uses chaotic logistic map, which involves two real numbers x0, μ as its initial conditions The key K = {x0, μ, IV }. Because the precision of the parameters x0, μ are taken as 10− 10 which is roughly equal to 2133 for the logistic map. The LFSR uses IV which is of 128 bits which creates key space of 2128. Therefor the final key space becomes 2133 × 2128 = 2261. This large key space eliminates all brute force and exhaustive attacks.

4.4 Correlation coefficient

It tells us how much relation exists between the same pixels of the original and the encrypted image. It is calculated from the formula below (4):

$$ r=\frac{{\sum}_{m}{\sum}_{n}(A_{mn}-\overline{A})(B_{mn}-\overline{B})} {\sqrt{\left( (A_{mn}-\overline{A})^{2}\right)\left( (B_{mn}-\overline{B})^{2}\right)}} $$
(4)

Where A and B are the original and the encrypted image respectively and their means. The lower the value of the correlation coefficient indicated a better encryption quality. The test results are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 4.

Table 4 Correlation coefficient test results and comparison with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17]

4.5 Plain-text avalanche effect

Avalanche effect is the study of how differences in an input can affect the resultant difference at the output. Attackers take a pair of images which differ in small magnitude and then generate their cipher images from the same algorithm. Then they compare the two encrypted images, hoping to detect statistical patterns in their distribution. There are two methods used to find performance against differential attacks.

Number of pixel change rate (NPCR)

it measures the percentage of different pixels between two cipher images whose plain images have only one pixel difference. Larger value is better. NPCR is calculated using (5). The test values of NPCR are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 5.

$$ D(i, j)= \left\{ \begin{array}{l l} 0 & \quad \text{if } C_{1}(i,j)=C_{2}(i,j)\\ 1 & \quad \text{if } C_{1}(i,j)\neq C_{2}(i,j) \end{array} \right. $$
$$ NPCR = \frac{{\sum}_{i, j}D(i, j)}{W \times H} \times 100 $$
(5)
Table 5 NPCR and UACI test results and comparison with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17]

Unified average changing intensity (UACI)

it measures the average intensity of differences between two cipher images by selecting 5 pixels randomly and the pixel value is changed by 1 bit. The test values of UACI are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 5.

$$ UACI:U(C_{1}, C_{2})=\sum\limits_{i, j}{\frac{D(i, j)}{T}\times 100 <percent>} $$
(6)

4.6 Peak signal-to-noise ratio (PSNR) and perceptual security analysis

Peak signal-to-noise ratio is one of the most important indexes for encrypted image quality. The test values of PSNR are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 6.

Table 6 PSNR and entropy test results and comparison with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17]

4.7 Information entropy analysis

The information entropy is defined as the degree of uncertainties in the system. The greater the entropy, the more is the randomness in the image, or the image is more uniform. Thus statistical attacks become difficult. Entropy is defined as in (7)

$$ H(m) = \sum\limits_{i=0}^{2^{N}-1}p(m_{i}) \times log_{2} \left[ \frac{1}{p(m_{i})} \right] $$
(7)

where p is the histogram counts returned from histogram. For an ideal random image, the entropy is calculated to be 8. So an entropy closer to 8 demonstrate better randomness in the image. The test values of entropy are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 6.

4.8 Avalanche effect

A small change is key or plain text should cause significant change in cipher image. Strict Avalanche 50 bit change in ciphered for 1 bit change in plain. To calculate Avalanche effect Mean Squared Error (MSE) is used in (8). Let C1 and C2 are two ciphered image with key differing in a single bit, expressed as (8). The test values of MSE are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 7.

$$ MSE = \frac{1}{M\times N}\sum\limits_{i=0}^{N-1}\sum\limits_{j=0}^{M-1} \left[C_{1}(i,j) - C_{2}(i,j)\right]^{2} $$
(8)
Table 7 MSE, irregular deviation, and maximum deviation test results and comparison with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17]

4.9 Maximum deviation

The high amount of irregularity and deviation of pixels among the original plaintext and cipher image provides good quality of encryption. First the histogram for plaintext image and the encrypted image is taken and their differences are calculated. Let di be the absolute difference between the 2 histograms for intensity I, then maximum deviation, D is calculated as shown in (9)

$$ D = \frac{d_{0}+ d_{255}}{2}+ \sum\limits_{i=1}^{256} d_{i} $$
(9)

The test values of maximum deviation are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 7.

4.10 Irregular deviation

An important property of encryption is that the plain pixels are having uniform probability distribution to effect all pixels uniformly during encryption process . If the encryption technique considers the plain image as source of random values, the deviation will have uniform distribution. The irregular deviation is measure of uniformity of distribution in the histogram. The uniform distribution of irregular distribution demonstrates the good quality of the encryption algorithm.

First the absolute difference of the plaintext image and the encrypted image is taken and its histogram, H is calculated. The average value for H is calculated as in (10) and (11).

$$ M_{H} = \frac{1}{256}\sum\limits_{i=0}^{255} h_{i} $$
(10)

Where hi is the amplitude of the histogram at index i. Thereafter irregular deviation is calculated by (11)

$$ I_{d}= \sum\limits_{i=0}^{255} |h_{i} - M_{H} | $$
(11)

The test values of irregular deviation are presented and compared with AES [12], Fu et al.’s method [5], Li et al.’s method [8] and Zhou et al.’s method [17] in Table 7.

4.11 Performance analysis

The performance efficiency of the proposed scheme was evaluated as time required to encrypt an image in real time. The time consumption was calculated on a system configured with Intel processor Core i5-8250U; 4 GB RAM, 500 GB SSD and Windows 10 operating system. The performance are compared with some existing schemes in Table 8. The encryption process was run with 256 bit kye (K) for all the cases. The encryption time and decryption time are also equal for all the cases as the number of operations are equal for both the processes. It can be notice that the proposed scheme is producing cipher in comparatively faster and very small time.

Table 8 Time needed for encryption or decryption in second with 128 bit key

5 Conclusion

The proposed encryption algorithm XOR operation and genetic operations (mutation and crossover) are used. The proposed method generates pseudorandom bit sequences of length 256 for one time, which reduces the computational overhead drastically. The large key space makes the encryption more secure and difficult for eavesdropper to compromise the confidentiality of the encrypted information. Histograms of cipher images are flat and uniform and have almost same frequency for each intensity level. The correlation between neighboring pixels in the cipher images turns out to be negligible and nearly equal to zero. Another advantage of the proposed method is that it can be applied to text data as well, despite that the analysis is performed only on images. In the method, the random sequence for current block is generated by previously encrypted block. So, one cannot decrypt the current cipher block without the knowledge of the previous image block. The proposed algorithm presents several interesting features, such as a higher level of security, large key usage, and uniform distribution of pixel values.