Keywords

1 Introduction

Compression techniques are used during transmission to efficiently convey the information via a medium of communication with a smaller bandwidth [1,2,3,4]. The redundant substance from the original information source is removed during the compression process so as to reduce the amount of the information. Lossy compression methods have a high rate of compression, they may also exclude some crucial information, whereas lossless compression approaches keep the information's integrity and certainty while compressing it enough [5, 6]. Another crucial factor is protecting the data during transmission from different unethical assaults. During transmission, encryption methods are combined with the data to ensure data secrecy [7]. Both symmetrical and asymmetric encryption methods are possible. Key creation is typically used to accomplish encryption. The transmitter key and receiver key in symmetrical encryption processes are identical, which makes it possible to intercept information in transit [8]. Using an asymmetrical encryption technique, where the receiver key is private but the sender key is public, can enhance security characteristics.

Both the compression and encryption processes are crucial for secure data transfer on lowered bandwidth. It is possible to use the compression technique either after or before the encryption. When encryption is applied to an un-compressed image, execution time is prolonged and the encryption process is misused [9, 10]. By adopting a compression strategy before encrypting an image, the likelihood that hackers will be able to decode it is decreased [9, 11, 12].

In this study, the RSA asymmetric encryption method is used after the Huffman lossless compression algorithm. The compression efficiency metrics Peak signal to noise ratio (PSNR), Mean square error (MSE) and Compression ratio (CR) are investigated to assess the performance of image reconstruction by comparing them to existing methods. The encryption efficiency of the proposed technique is assessed using entropy and coefficient of correlation studies. Five typical grayscale test images with a 512 × 512 pixel size are used for the research experiment.

2 Related Work

M. Yassein et al.‘s study on several encryption methods in the symmetrical and asymmetrical categories was published in 2017 [13]. The asymmetrical encryption algorithm RSA is contrasted with the symmetric encryption techniques 3DES, AES, Blowfish, and DES. The RSA encryption approach offers higher protection against various assaults, as shown by the authors’ analysis of the symmetrical and asymmetrical encryption algorithms using various metrics for evaluating encryption performance. Galla et al. [14] executed RSA technique for image data encryption in 2016. The authors have shown how the RSA method depends on number factorization. Jumgekar et al. [15] also developed and illustrated basic cryptanalysis in 2013 and explained the implementation of RSA method through the production of public and private keys. A RSA encryption technique was introduced by Jonsson et al. [16] in 2002, and it was compared to the incomplete RSA algorithm. Authors have demonstrated that security characteristics based on pseudo-random functions are diminished by TLS-based algorithms. By modernizing the computing procedure, Katz et al. [17] demonstrated the contemporary cryptanalysis method in 2014, which lowers the drawbacks of complete secrecy. Authors have employed a private key encryption technique and message signal authentication.

S. Han et al. [18] solved the neural network restrictions in 2016 by demonstrating the deep compression technique. Pruning, quantization, and Huffman coding are all components of this deep compression technique. The deep compression strategy, according to the authors, lowers the need for storage without compromising the accuracy of the rebuilt image. To improve the compression effectiveness and privacy of text-based information, E. Satir et al. [19] published a lossless Huffman compression approach in 2014. A lossless image compression technique comparable to bzip2 was devised in 2012 by Y. Zhang et al. [20] with the goal of parallelizing the development of Huffman coding, BWT and MTF. To demonstrate the advantages and disadvantages of the recommended algorithms, a performance study is also conducted.

Using LZW and Run length encoding, M. Sharma [21] examined Huffman compression approach in 2010. The author shows that Huffman coding has a higher compression ratio and efficiency than other compression techniques.

According to a survey of the literature, Huffman coding is the most popular lossless compression method, which encourages future study to increase the reconstructed image compression ratio and effectiveness. This research paper goal is to apply asymmetrical encryption on lossless compressed grey scale photos and examine the results.

3 Fundamental Information and Proposed Model

A form of lossless compression method based on how frequently pixels occur in visual data is called Huffman coding (Fig. 1).

Fig.1.
figure 1

Fundamental structural representation of suggested system paradigm

In the Huffman coding, Image pixels are placed according to their frequency in decreasing order. Once more, each pixel is ordered in decreasing order of frequency of occurrence after merging the frequencies of the two pixels with the lowest frequencies. This procedure will continue until there are only two frequencies of pixels left. The last two pixel frequencies are stored by giving higher frequency pixels a value of 0 and lower frequency pixels a value of 1.

figure a

RSA generates two unique keys. A public key has been allotted to the transmitting side of the communication. The recipient is given a private key in addition to another key. The choice of two enormous prime integers is key to the security of this procedure. The three essential components of the RSA encryption technique are key creation, encryption, and decryption.

figure b

4 Evaluation of the Effectiveness of Compression and Encryption

4.1 Parameters for Evaluating Compression Efficiency

To evaluate the efficacy of the Huffman compression approach, PSNR and MSE are used. For an image to be successfully reconstructed, the PSNR must be high, or over 30 dB, and the MSE must be as low as possible.

$${\text{PSNR}} = {log}_{10}\left[\frac{\left\{{J\times K\}}^{2}\right\}}{MSE}\right]$$
(1)
$$\frac{1}{J\times K}{\sum }_{X=1}^{J}{\sum }_{Y=1}^{K} [u\left(x,y\right)-v(x,y)]^2$$
(2)

where \(u\left(x,y\right)\) and \(v\left(x,y\right)\) denotes the uncompressed and compressed pixel respectively.

4.2 Parameters for Evaluating Encryption Efficiency

4.2.1 Analysis Based on Entropy

The average amount of information in a lengthy string of pixels in an image data is referred to as entropy.

I(Xi) has m distinct symbols, and the mean value or entropy is given by

$$\mathrm{H}\left(\mathrm{X}\right)=\sum \nolimits_{\mathrm{i}=1}^{\mathrm{j}}\mathrm{P}\left({\mathrm{X}}_{\mathrm{i}}\right)\mathrm{I}({\mathrm{X}}_{\mathrm{i}})$$
(3)
$$\mathrm{H}\left(\mathrm{X}\right)=\sum \nolimits_{\mathrm{i}=1}^{\mathrm{j}}\mathrm{P}\left({\mathrm{X}}_{\mathrm{i}}\right){\mathrm{log}}_{2}\mathrm{P}\left({\mathrm{X}}_{\mathrm{i}}\right)$$
(4)

4.2.2 Analysis Based on Correlation Coefficient

The correlation coefficient between two neighboring pixels on the horizontal, vertical, and diagonal axes is used to describe the correlation between the original and encrypted image. This is how the correlation coefficient is shown:

$$\mathrm{C}=\frac{\sum_{\mathrm{i}=1}^{\mathrm{j}}\left({\mathrm{x}}_{\mathrm{i}}-\overline{\mathrm{x}}\right)\left({\mathrm{y}}_{\mathrm{i}}-\overline{\mathrm{y}}\right)}{\sqrt{\sum_{\mathrm{i}=1}^{\mathrm{j}}{({\mathrm{x}}_{\mathrm{i}}-\overline{\mathrm{x}})}^{2}} \times \sqrt{\sum_{\mathrm{i}=1}^{\mathrm{j}}{({\mathrm{y}}_{\mathrm{i}}-\overline{\mathrm{y}})}^{2}}}$$
(5)

where \(\overline{\mathrm{x}}\) and \(\overline{\mathrm{y}}\) can be expressed as

$$\overline{\mathrm{x}}= \frac{1}{\mathrm{K}}\sum \nolimits_{\mathrm{i}=1}^{\mathrm{k}}{\mathrm{x}}_{\mathrm{i}}\;{\text{and}}\;\overline{\mathrm{y}}= \frac{1}{\mathrm{K}}\sum_{\mathrm{i}=1}^{\mathrm{k}}{\mathrm{y}}_{\mathrm{i}}$$
(6)

The original image's neighboring pixels must be significantly connected with one another in the horizontal, vertical, and diagonal dimensions. As a result, the correlation coefficient must be high. However, an encrypted image should have little to no pixel correlation and a low correlation coefficient.

5 System Environments

MATLAB 2018 is used in this experimental investigation to simulate the outcomes. Operating system utilized is Windows 10. 512 × 512 standardized grayscale test pictures. To authenticate the outcomes, we use the bmp format from the SIPI data store.

6 Results of Proposed Model

Table 1 displays results for compression efficiency parameters. Existing techniques are also contrasted. The compression efficiency is represented by CR, PSNR, and MSE. Graphical depiction of compression efficiency characteristics is shown in Fig. 3.

Fig. 2.
figure 2

Representation of pictorial outputs during proposed compression and encryption process

Columns 2 and 3 of Fig. 2 display the input image and distribution of the associated correlation coefficients, respectively. Columns 4 and 5 respectively display the compressed encrypted (CE) picture and the distribution of the related correlation coefficients, while column 6 displays the reconstructed image following decryption and decompression (Table 2).

Table 1. Results obtained for proposed CE technique in terms of MSE, CR and PSNR
Table 2. Results obtained for proposed encryption scheme in terms of entropy and Correlation coefficient
Fig. 3.
figure 3

Comparison chart among values of MSE, CR and PSNR

7 Conclusion and Future Scope

In this study, image data is compressed and encrypted using the Huffman lossless compression algorithm and RSA asymmetrical techniques. According to a review of the data, the dynamic range of the PSNR of the Huffman compression approach is lying between 30 to 40 dB, which is beyond the minimum requirement of PSNR for successful compression while it offers a sizable compression ratio. MSE, with a range of 6.85 to 47.64, is a less sophisticated algorithm than other cutting-edge ones. The low correlation coefficients of encrypted images show that the RSA encryption method is resilient to numerous attacks and the entropy being in the range of 3.72 to 3.93.