1 Introduction

With the enormous use of technology, the exchange of photos and graphical data has increased rapidly. Secure transmission of data over networks has been a challenging issue for computer scientists since last many years. The present era is full of cybercrimes, sharing secrets is the most difficult task throughout the networks. Data scientists are diligently trying to implement several techniques and methods to combat against cybercrime and for the secure transmission of the data. Maintenance of the integrity and authentication of images is an important debate nowadays. Every day several images and secrets in the form of the photos have been shared from one point to the other, but the major concern here is to make it as secure as possible [16, 20]. Steganography and visual cryptography are the two basic tools that help to protect data privacy in today’s transmission channels.

Steganography is the combination of two Greek words where ‘steganos’ means ‘hidden’ and ‘graph’ means ‘to write’. Therefore, steganography refers to hiding a secret message in a text, photo, audio, or video file [6]. Usually, steganography is done by replacing the Least Significant Bits (LSBs) with the secret message bits. In the literature, techniques exist that exploit the similarities between the cover and the secret image to increases the embedded efficiency of the program [1]. Whereas, cryptography is the method of changing useful secret data into meaningless or undetectable data using different techniques. While Steganography conceals the secret text in the visible readable cover media. Such text can detract hackers or intruders and it is hard to find the hidden text. But unfortunately, both of these methods face a setback in form of Single Point of Failure (SPOF) [7, 28] as these methods can halt the entire single storage system from working. To overcome this issue, Visual Cryptography (VC) has been introduced.

Visual cryptography is one of the cryptography techniques that is used for encryption of visual and text data such that the decryption can be done visually avoiding any complex computational assistance [8]. The amazing part of visual cryptography is that it is impossible to regenerate or get any information from a single share hence making it an enhanced encryption technique. These techniques can equally be applicable on binary, gray, or colored images. The concept of Visual cryptography is based on black and white pixels. It can work on various ways and by making a blend of different techniques. Nowadays, researchers have introduced watermarking with Visual Cryptography for more protection [24]. Figure 1 shows the overall working of virtual cryptography i.e. from acquiring the secret image, dividing it into shares, stacking of the shares, and getting back the secret image.

Fig. 1
figure 1

A block diagram of a typical visual cryptography scheme

In visual cryptography, security is achieved by encrypting multiple shares but there is a possibility that intruder can get all these shares and apply some decryption and get all the information. It is indeed a main security threat in present cryptography techniques. For this purpose, a concept of fake share has been introduced. Fake share is a combination of black and white pixels that are adjusted randomly and look more or less like the real shares. The fake share visually look like a real share but the information cannot be decrypted in the presence of fake share. It enhances the security of the secret image. The use of fake shares improves the encryption twice more secure and reliable.

Highly secure transmission, less complexity, and ease of implementation on different image types are some of the basic advantages of visual cryptography. Moreover, it can securely conceal important details. Some of the major advantages of visual cryptography that make it even more strong then others are the following:

  • Visual cryptography ensures the maximum security of message/image that has been transmitted.

  • Decoding is simpler than any other cryptography scheme and can be done by the human eye and no additional computation or aid is needed.

  • It is robust against the noisy compression techniques due to its binary attribute.

  • It does not have a single storage system, means image data is separated into different shares making it even more reliable.

Even though visual cryptography has shortcomings like low image quality etc., but still it is the best way to make secure messaging/transmission at a minimal cost and less computation complexity.

The main contribution of this paper are as follows:

  1. 1.

    In this paper, a new visual cryptography scheme is proposed that utilizes both Advance Encryption Standard-AES and Half-toning making it more secure.

  2. 2.

    The proposed scheme works on both binary and color images.

  3. 3.

    In contrast to the existing techniques which are secure at the cost of computational complexity at the decryption size, the proposed scheme is free of complex computation at the decryption end. Decryption can be done in no time with maximum security and minimum time complexity.

2 Background

2.1 Origin and basics of visual cryptography

Visual cryptography is the method of securing the image and its data from the cheaters and hackers. The main purpose of this scheme is to share secret images securely and effortless. This technique originally is one of the simplified ways of sharing of a secret image that no one can retrieve the original image without having all the generated shares of the image.

It was implemented on the black and the white pixels or an image of the visual data. Shares from the original messages were created using some code tables. For the decryption of the secret message at least k shares were needed out of n shares. Availability of all n shares means the perfect decrypted image similarly the smaller number of shares means the least clear decrypted share image. The authors originally proposed two schemes (k,n) and (n,n). In (k,n) at least k shares are needed to decrypt the image. Similarly, in (n,n) all shares are mandatory to get the secret image back [5]. The most remarkable feature of this technique is its decryption which can be done simply by the human eye; for this one must stack all the shares or transparencies that can be interpreted by the naked eye. Figure 2 shows the traditional visual cryptography scheme. Here bit value 0 represents the white pixel and bit value 1 represents the black pixel. Bit value 0 makes the stacked pixel that has some white component in it. Similarly, when the pixels of 2 black bits stacks together they originate the black pixel.

Fig. 2
figure 2

An example of stacked shares in (2, 2) visual cryptography scheme

Pixel expansion has been employed by some of the visual cryptography schemes. A pixel divided into four parts or subpixels resulted in the doubled sized image at the output [12].

2.2 Types of visual cryptography

With the enhancement of research and technology, many other types of visual cryptography on the basis of color, size, and pixels has been presented. The details of few such schemes are discussed below:

2.2.1 Size invariant visual cryptography

Methods based on the initial visual cryptography technique where input secret image and the retrieved secret image are of the same size, is named as the size invariant Visual Cryptography. It was developed for both the (k,n) and the (n,n) schemes [26] (see Fig. 3).

Fig. 3
figure 3

Size Invariant (2,2) Visual Cryptography (a) Secret image (257 × 101) (b) Share 1 (257 × 101) (c) Share 2 (257 × 101) (d) Recovered secret (257 × 101)

2.2.2 Extended visual cryptography

In Extended Visual Cryptography the meaning full shares are generated (shares are some unclear images) that can confuse the hackers and the intruders with the original secret image hence it results in a more secure scheme. This is based on the traditional Visual Cryptography Scheme. Figure 4 shows examples of Extended VC scheme where two meaning full shares are produced by the two cover images and the secret image is hidden between these two shares. By stacking both images one can have the secret image.

Fig. 4
figure 4

Extended Visual Cryptography (a) Secret (192 × 192) (b) Base image 1 (c) Base image 2 (d) Extended share 1 (384 × 384) (e) Extended share 2 (384 × 384) (f) Recovered secret after superimposing share 2 atop share 1 (384 × 384)

2.2.3 Dynamic visual cryptography

It focuses on hiding multiple secretes by using two or more shares keeping uniform image size. Commonly, two secret images are hidden in the two shares. It is only for the two shares that make it somehow less secure in use.

2.2.4 Color visual cryptography

Nowadays, the Color Visual Cryptography is an interesting and commonly used techniques to encrypt colored images and information. With the advent of image processing techniques, colored images are more commonly used compared to the grayscale and binary images [25].

2.3 Half toning

Halftone is a technique that is used to reproduce any image with the help of dots of different sizes. As a result, the image is shown in the continuous tone like in a pixelated background. It is a visual effect that has been applied to the digital images to process an image more efficiently. The working principle and phenomenon is very simple and straightforward in which pixel is considered as a dot with various sizes. Hence some of the dots can take some more space than a pixel. The resultant image has the dots equal to the image total resolution but in a non-continuous manner (see Fig. 5). Usually, the binary image is obtained from the result of the gray image halftoning process. Halftone Visual Cryptography is proposed by Pahuja et al. [13] by using the intensity of the printed dots for halftoning the grayscale of the pixels. More intense and denser dots show the darker contrasts and lighter parts are highlighted by the widely spaced dots within the halftoned image. From this technique, the continuous tone image can be generated with either a black or white color. Later, that generated image can be converted into a binary image. Image resolution can be effected by using image halftone technique but in case of Visual Cryptography, it always gives a perfect outcome. Although one should select a good halftoning technique for better picture quality.

Fig. 5
figure 5

Halftone image

One of the common halftone methods widely used in image processing is Error Diffusion. It has minimum computational complexity and has good image quality. Quantization error diffuses into the neighboring pixel that results in a better-quality output image. The homogeneous spreading of pixel makes the share images quality even. Direct Binary Search (DBS) is another technique in Half toning used in the encoding of the secret pixels [27]. Toggle and Swap are the basic operations of DBS Half toning. Toggle is the basic operation in DBS used to change the position of the pixel and Swap operation is used to change the position of the specific pixel concerning its eighth nearest neighbor pixels. Usually, this eighth neighboring pixel has a different value but in case if the pixel has the same secret value then the toggle and swap will be prohibited.

2.4 AES-CBC cipher algorithm

Advanced Encryption Standard (AES) has three variants: AES-128, AES-192, and AES-256 with varying key lengths of 128, 192, and 256 bits respectively. Symmetric Key Cipher uses the same key for encryption and decryption so that the sender and the receiver both know that single key [20]. AES consists of rounds that vary according to the key length. 128-bit keys have 10 rounds, 192-bit keys 12 rounds, and 14 rounds for 256-bit keys. Each round consists of various processing steps including substitution, transposition mixing, and transformation of the final output. It is the combination of sequential steps that repeats round wise shown in Fig. 6. Initially, a round key is added to the plain text. In add round key bit-wise XOR is used to make a combination of every byte of state matrix and round key. Substitution bytes is the substitution of one byte to another using the lookup table. Similarly, In shift rows, the last three rows have to be a shifted in some number of steps in a cycle. Every column of the state matrix is multiplied by a polynomial in a mix column step.

Fig. 6
figure 6

AES encryption and decryption

Cypher Block Chaining (CBC) invented in 1976 is one of the most secure encryption method used widely in data transmission. Block cipher is suitable for the transmission of data securely of a specific length of bits known as a block. Before Encryption in CBC previous Cypher blocks are XORed with each block of text. That pattern makes the final block dependent on all the previous cipher blocks and hence enhances the security.

Figure 7 shows the proper propagation of CBC mode of encryption and decryption. Initialization Vector (IV) is the sequence of binary bits that have been used in the first block of the CBC to make every text unique [3]. The mathematical formula for the CBC Encryption is as follows:

$$ C_{i} = E_{K} (P_{i} \oplus C_{i-1}) $$
(1)
Fig. 7
figure 7

CBC encryption and decryption

Similarly the relation for CBC Decryption is as follows:

$$ P_{i} = D_{K}(C_{i}) \oplus C_{i-1} $$
(2)

In the encryption process, Ci the ith block of the ciphered text is obtained by taking the XOR of the ith block of the plaintext and the block of the ciphered text obtained before and encrypted with the session key K. Similarly, in the decryption process, Pi the ith block of plaintext is obtained by decrypting the ciphered text with the session key K and taking the XOR with the previous ciphertext block. Here, in both the cases first block of ciphered text (Co) is taken as the Initialization vector IV. The descriptions of the symbols used in the expressions are also provided in Table 1.

Table 1 Description of symbols used in the expressions

3 Related work

Paknahad et al. in [14] proposed a user-friendly scheme for the secure sharing of color images where the meaning full shares were produced that somehow simplify the mass data management. The analysis of the shared and the stacked images was done in the first step and image quality enhancement was done in the second step.

Similarly, another secure share construction scheme [21] was introduced using a (2,2) VC scheme. Secure shares were created by encrypting them through the AES algorithm. In this scheme, the AES and shares retrieve the secret image together after the complex decryption method. Although this scheme is more secure, it is more complex in encryption as well as in decryption.

A novel XOR-based cryptography technique for the share generations of the binary images was developed in [15]. Random pixels selection for the generation of the shares were adopted in which one did not need to deal with any kind of code-book and the pixel expansion process. But this method is somehow more complex than others and hard to implement.

In another research work, the Discrete cosine transform (DCT) was adopted for enhanced secure transmission within the networks. This technique is suitable if someone has to transmit the secret image within the network [19]. The authors adopted two approaches for image transmission that involves the combination of image compression, encryption, transmission, and decryption.

Ibrahim et al. in [10] proposed a color specific visual cryptography scheme using the binary dragon fly algorithm. The color image was separated into three Red, Green, and Blue layers and BDA then applied in order to get the shares of the input secret image. These shares were then grouped back, once the color level of the image was noticed through histogram. That version of visual cryptography dose not use the 2 by 2 visual cryptography scheme. Although it gives the good results but the security in this proposed scheme is a major concern.

Similarly, [11] discussed the XOR operation based Visual Cryptography techniques especially for the more secure bank transactions. Interestingly the authors considered the joint account scenario in their research. This technique was implemented on gray images only. Images were concatenated and then the shares were generated from the resultant image after concatenation. Similarly, in the decryption phase, the shares were then stalked image was used for the extraction of the two initial images. This can only be done by the consent of both the users at a time making it a perfect scheme for the joint account holders.

In [17], the QR code was used for the better and secure transmission of the secret images into the network. The generated shares of the image were stored in the different databases in the form of the QR codes which enhances the security and minimize the data loss risks during transmissions. Safe transmission through QR code is one of the applications of the Visual Cryptography technique.

Nowadays, in addition to the binary images, color images are also transferred within the network that needs to be secured. Therefore, there is a need for more secure, less complex, and an improved scheme that can be applied to both the binary and the color images.

Table 2 shows the comparison analysis of some of the existing Visual Cryptographic techniques. From the data, we can see that some of the techniques are complex and some cannot be applied on the color images. Moreover, the security is high in most of the techniques, at the same time they are complex and require high computational devices for decryption.Here, low security and the high complexity are the limitations of these researches. Visual cryptography ideally do not need any kind of computational process at decryption. Our proposed scheme can process both the color and the black images with minimal complexity. A detailed comparison of the proposed VC algorithm with other benchmarks is presented in Table 3.

Table 2 Comparison of different visual cryptography schemes
Table 3 Comparison of the proposed VC scheme with other benchmarks

4 Methodology

This section describes the detailed methodology of the research work. The proposed VC scheme is written in Python and consists of two main parts i.e., encryption, and decryption. Algorithm 1 shows the encryption part where the user has to set the passcode first and then algorithm prompt for further image acquisition and the encryption process. For the password setting up process, the passwords have to be rewritten to confirm it. The algorithm checks the password if the password does not match, the user again has to choose a password. After this part, the generation of n + 1 shares takes place where the user has to select the secret image and the system generates n + 1 shares of the image. Here n shares are the original shares of the image while one share is a fake share. In the third step, the user has to enter the password again to authenticate the user so no one can be modify or have the VC shares. Once the correct password is entered the algorithm applies AES encryption on the shares. If the password is wrong the proposed algorithm will display the error and one has to repeat the encryption process from the very first step. Finally, after the successful AES encryption, the algorithm returns all encrypted shares.

In the Algorithm 1, x represents the password that has to be set by the owner. xnew is the password typed again for the verification of the password (x). \(x^{\prime }_{new}\) is the password needed for verification at the point when the AES encryption has to be done on the generated shares.

Once encryption is done, shares are secure to transfer through the network. In this work, decryption depends on the password that has been entered by the receiver. Algorithm 2 describes the decryption phase. If the receiver enters the correct password (that has been picked up during encryption) then the algorithm returns the original image decrypted shares. By stacking these shares receiver can get the original secured image restores. While in another case, if the wrong password has been entered so the system will return the fake share along with an original image share. So in this case, the receiver will not be able to recover the secret image. We have a choice here to show the stacked image output as any random image that can distract the hacker or intruder or we can simply display the resultant image.

figure a
figure b

Figure 8 is the workflow of the whole encryption process. For better understanding, we have split the Workflow into different stages. Below, the stages are discussed in detail:

Fig. 8
figure 8

The workflow of proposed VC encryption algorithm

4.1 Setting up a passcode/password

In the very beginning, the user is asked for the password that will later be used in the encryption and decryption phase. This password can be transferred through the network, using the steganography technique. Where the password is hidden within the image or in some cases into any audio/video file.

4.2 Image acquisition and recognition

The user selects the image to be encrypted, then this specified image will be checked by the program whether it is a Binary/Grayscale or a color image. The following are the sequential steps that are instructed in the Python program to be followed.

  1. Step1

    Image Acquisition: Algorithm will ask about the image you want to process. By loading the image name, Image Acquisition has been done.

  2. Step2

    Colour/Binary recognition: In this step Image type will be detected by the algorithm. Algorithms tell the user either it’s Binary/Grayscale or it’s a color image. After the detection, specific encryption methods will be initiated according to the image type.

4.3 Encryption

Different techniques like CrossOver, Mutation, Gray Component Replacement (GCR), Halftoning, 2, 2 Visual Cryptography, and Advanced Encryption Standard have been used during the encryption process. Here are the steps designed for the encryption of the secret Image.

  1. Step1

    RGB Layering: Once the image has been detected as colored one, the image will be converted into its different Red, Green, and Blue layers. Hence, the Image split has been done so each separate layer can be processed accordingly.

  2. Step2

    Gray Component Replacement (GCR): It removes the gray toning that was produced by the effect of the yellow, magenta, and cyan separations. GCR is applied in the case to accomplish the halftoning.

  3. Step3

    HalfToning: Halftoning has been applied to each separate Colored Layer involving Red, Blue, and Green. The process of halftone makes the dots of the random sizes and spread it in the resultant image that gives a blurry texture.

  4. Step4

    (2,2) Visual Cryptography Scheme: Visual Cryptography scheme initiated is applied to get different shares of the secret image. A novel idea to generate a fake share has been executed in this stage. Hence after that step, we get 3 shares, 2 basic image shares and one is the Fake share that will be used for the security purpose in the decryption process.

  5. Step5

    AES Encryption: Before applying the AES scheme the program will ask for the password again. That is for the enhanced security that no one can access the shares but only the authorized user.

After the authentication, the shares will be AES secured. Hence double encryption has been done in this scheme: First the Visual Crypto shares generation and second the AES encryption itself.

At the end, the shares are now fully encrypted and safe. The idea of the fake share generation makes this proposed scheme even more improved and advanced.

Figure 9 shows the detailed workflow of the decryption process.

Fig. 9
figure 9

The work flow of proposed VC decryption algorithm

4.4 Decryption

Decryption Process starts with the password. The user has to insert a password first. The novelty from the typical decryption processes, here is the concept of the fake share. Fake share is the random share that has been created from the random bits of the image. There are two scenarios/cases: A successful one and a failed one. Only the authorized user will be able to get the secret image back only if he writes the correct passcode. Otherwise, in case of the wrong password, there will be no image. In another variant of this program, there will be another random image in the output. In case of an incorrect password, decryption will be done using fake share.

4.4.1 Case 1: decryption without fake shares – secret image restored

Here, in this case, the user has inserted the “Correct Password”.

  1. Step1

    Shares Decryption: In this step, the selected shares have to be decrypted as they were AES encrypted before. Now once the shares decryption is the successful program will jump to the next step.

  2. Step2

    Stacking/ORing: The decrypted shares will now be pixel vise ORed or stacked together to get the secret image back. After the stacking one can see the secret image.

4.4.2 Case2: decryption with fake shares – secret image not restored

Adding the wrong or incorrect password. Step1. Shares Decryption: As we have done before, In this step the selected shares have to be decrypted as they were AES encrypted. Now once the shares decryption is successful next step will be executed. Step2. Stacking/ORing: On the stacking of the shares, in this case, one will be unable to get back the secret image. Hence the Image is still secured and can not be restored.

5 Results and discussion

The proposed VC scheme works for both the color and the binary images. The algorithm first asks for the operation type, which can be either ‘Encryption’ or ‘Decryption’. Once prompted, the detection takes place. After getting to know about the image type, it works accordingly as instructed. Figures 10 and 11 represent the secret color image and binary image used in the experiments.

Fig. 10
figure 10

Example secret color image used in the experiment

Fig. 11
figure 11

Example secret binary image used in the experiment

5.1 Shares of binary image

The proposed VC scheme is applied on the color and binary images. Figure 12a, b, and c represent the first, second and last shares generated by the proposed VC method on the binary image example.

Fig. 12
figure 12

Example share images generated by the proposed VC algorithm on binary image example (a) Share 1, (b) Share 2, (c) Fake share

5.2 Shares of color image

The resultant shares generated for the color image case using the proposed VC scheme are shown in Fig. 13 where Fig. 13a, b, and c represent the first, second and last shares respectively generated by the proposed VC method for the color image example.

Fig. 13
figure 13

Example share images generated by the proposed VC algorithm on color image example (a) First share of color image, (b) Second share of color image, (c) Fake share of color image

5.3 Resultant images

According to the cases discussed above, there will be a recovered secret image when the image original shares are stacked together in Case 1. Similarly, when the fake share is stacked with the other image share, the image will not be recovered. Figure 14a shows an example of binary image Case 1 (when the photo is recovered) whereas Fig, 14b shows Case 2 (when the image is not recovered). Similarly, Fig. 15a represents an example of color image Case 1 (when the photo is recovered) whereas Fig. 14b shows Case 2 (when the image is not recovered).

Fig. 14
figure 14

Results of binary images (a) Case 1: Secret image is recovered (b) Case 2: Secret image not recovered

Fig. 15
figure 15

Results of color images (a) Case 1: Secret image is recovered (b) Case 2: Secret image not recovered

The proposed VC algorithm is also evaluated for false positive. A false positive is said to occur, if a wrong combination of the owner and master shares results in a visual trace of the secret image.

6 Conclusion and future work

Every day, millions of pictures have been shared over data networks. This growing trend makes the network even more vulnerable and insecure for restricted or confidential images/data. Hence, the need to transfer images securely throughout the network is rising rapidly. Many secured and complex VC has been presented today. Many of them have very high security but at the same time, they are complex and difficult to compute. Here the Concept of visual cryptography is disgraded. The main purpose of this scheme is to provide security with minimal complexity and almost zero computation. Our proposed scheme has minimal complexity with the ability that it is for both the color and the binary images. The concept of fake share makes it even more secure, novel, and improved. Hence, the owner can secure his image even if he has given shares to the untrusted third party. Since there is always room for improvement. Many more improved encryption schemes can be added in the future to make it even more secure and even impossible to crack. Similarly, by applying some different concepts the resultant image can be generated in color with high visibility and clear view.