• No results found

Image Encryption and Decryption Using Image Gradient Technique

N/A
N/A
Protected

Academic year: 2020

Share "Image Encryption and Decryption Using Image Gradient Technique"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

International Journal of Emerging Technology and Advanced Engineering

Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 1, January 2013)

511

Image Encryption and Decryption Using Image Gradient

Technique

Shetty Deepesh Sadananda

1

, Anusha Karkala

2

Department Of Computer Science Engineering, NMAMIT, Nitte (Karnataka), India

Abstract Cryptography is considered as a method for securing data in a way, such that by applying particular mathematical operations or logic, the original data is converted into data of totally different form which is not easily detectable. This paper gives a methodology of how an image undergoes encryption in two levels namely intensity variation and pixel color value swapping, which travels via network and reaches the intended receiver who performs reverse operation, called decryption, using secret key to get back the original data without risk of information being leaked out to third parties. This paper also puts forward new algorithms developed for varying intensity of each pixel and for swapping pixel values within an image. The numeric values used for above encryption called as ‘key’ is shared as secret key between sender and receiver which are in turn encrypted as images while sending ,which is a unique factor put forward in this paper. This paper tries to bring about the

fact that by simple manipulation of pixel color

values(gradient) and not using external images for this methodology stands as a unique factor.

KeywordsCryptography,pixel intensity,swapping

algorithm.

I. INTRODUCTION

In cryptography the only need of high importance is security of data[1].Few ways to achieve it is through public key cryptography(PKC),secret key cryptography(SKC) and

using hash functions. Generic PKC employs two keys that

are mathematically related although knowledge of one key does not allow someone to easily determine the other key. One key is used to encrypt the plaintext and the other key is used to decrypt the ciphertext(encrypted data). Because a pair of keys are required, this approach is also called asymmetric cryptography. The important point here is that it does not matter which key is applied first, but that both

keys are required for the process to work.In SKC, a single

key is used for both encryption and decryption. Sender uses the key (or some set of rules) to encrypt the plaintext and

sends theciphertext to the receiver. The receiver applies

the same key to decrypt the message and recover the plaintext. Because a single key is used for both functions, SKC is also called symmetric encryption. With this form of cryptography, it is obvious that the key must be known to both the sender and the receiver; that, in fact, is the secret.

The biggest difficulty with this approach, of course, is the distribution of the key. This paper provides a SKC method wherein a different approach is used to share secret key between sender and receiver, that is through encryption of numerical secret key into an image which is difficult to trace; Since intruder may consider it as a normal scribbled image which carries no importance. Even if image is captured by intruders there are algorithms designed where pixel color values forming image hold the secret key values in different patterns. And moreover the secret keys are distributed among three images. Even if a single image is missing then it is impossible to obtain complete secret key which in turn is impossible to decrypt ciphertext. If numerical secret key is sent directly there is high scope for intruders to capture it and easily trace out the secret key. Hash functions, also called one-way encryption, are algorithms that use no key. Instead a fixed length hash-value is computed based upon the plain text that makes it impossible for either the contents or length of plaintext to be recovered. Hash algorithms are typically used to provide a digital fingerprint of a file‟s contents often used to ensure that the file has not been altered by an intruder or virus. Visual cryptography is also another type of cryptography which encodes a number of images in the way that when images on transparencies are stacked together, hidden message appears without a trace of original images. Decryption is done directly by human visual system with no special cryptographic calculations.

This paper takes into consideration a bitmap image which is fed into the algorithms to output an encrypted image. Bitmap images taken into consideration are 24 bit and 32 bit color space (bits per pixel-bpp). The 24 bit color space has three colors within it, viz. Red, Green and Blue. In 32 bpp, we have an extra alpha component

(transparency). And each color is madeup of 8 bits making

up a total of 24/32 bits. Each color can have a value from 0 to 255[2]. It also takes help of numbers which are

generated randomly on every run of the application and

hence acts as secret keys.

(2)

International Journal of Emerging Technology and Advanced Engineering

Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 1, January 2013)

512

II. ALGORITHMS

Two types of encryption have been proposed that an input image should undergo viz. intensity variation and pixel value swapping in same order.

A. Intensity Variation

Intensity variation is the first type of encryption where three random numbers rb, rg, rr are generated for each pixel corresponding to each colour in a pixel[3]. Three flag values are maintained for the same, viz. flag_b, flag_g and flag_r; the actual color values of a pixel be b, g, r. Fig.I underwent intensity variation encryption according to pseudocode of Fig.III resulting in Fig.II.

B. Pixel value Swapping

[image:2.612.334.554.114.410.2]

Pixel value swapping is the second type of encryption applied on intensity varied image. Input Image is divided into 4 blocks b1, b2, b3 and b4. During implementation of this algorithm, the exact pixel position where last swap has been done has to be saved, since pixels are accessed sequentially. After the pixels in b1 are swapped completely, process moves ahead to b2, where swapping is continued from the position which underwent last swapping with b1. Same procedure is applied for b3. This procedure is not repeated for b4 since it contains pixels from b1, b2 and b3.

Fig. I: Input Original Image

Fig. II: Intensity Varied Image

Fig. III:Pseudecode for Intensity Variation

Pixel swapping algorithm is referred to as „one swap per pixel‟, since very pixel undergoes swapping only a single time[2]. There exists an exception condition wherein if all

pixels of block b1 get exchanged withall pixels of b3, then

[image:2.612.121.215.427.589.2]
(3)

International Journal of Emerging Technology and Advanced Engineering

Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 1, January 2013)

[image:3.612.59.562.91.704.2]

513

Fig. IV:Pseudeocode for ‘One Swap Per Pixel’

Fig. V:Pixel Value Swapping Possibilities

Fig. VI:Encrypted image using ‘One Swap Per Pixel’

C. Shares

During the second type of encryption, pixel swapping is done based on random values of each pixel (refer Fig.III). The actual colour values of pixels (b, g, r) are swapped and not the random colour values. The random colour values of every pixel generated during first step of encryption remains intact in its respective pixel position and is not altered during process of swapping .

Fig. VII:Pseudocode for Creating Factors

[image:3.612.60.278.117.693.2]
(4)

International Journal of Emerging Technology and Advanced Engineering

Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 1, January 2013)

[image:4.612.57.281.111.379.2]

514

Fig. VIII:Pseudocode for Creating Shares

Fig. IX:Output Shares-Share1,Share2,Share3

III. DECRYPTION

Decryption is exactly the reverse procedure of encryption. When the receiver obtains three shares and encrypted image, extraction of the numbers from shares(random values and flag values) are to be done. This extraction of numbers from image is considered as the highlighting factor of this paper, since numbers are converted to bitmap image format which is a new concept introduced in this paper. The process of extracting numbers from the image and change in intensity of pixels in an image is called gradient technique. Therefore the title of the paper „Image gradient technique‟[5].

Accordingly, after the shares and encrypted image reaches the receiver, the receiver uses factor method to extract random number from shares which is then multiplied to obtain the colours of pixels. The order of receiving shares is not important,but obtaining all the three shares is mandatory. After this, the receiver uses random numbers to apply it to „one swap per pixel‟ algorithm to get back the original intensity varied image as in Fig.II. The flag values are then used to determine whether the random numbers are added to original colour values or not.

Accordingly, we either subtract random values from colour values or we do not.

The alpha values are redundant since alpha components of the shares provide all three colour flag values. Thus, final input image as in Fig.I is obtained.

IV. IMPLEMENTATION DETAILS

Implementation of algorithms is done in .NET framework 4.0. The .NET Framework 4.0 is an integral Windows component that supports building and running the next generation of applications and XML Web services[6].

The outcome of the random generation function is unpredictable. Hence the random numbers can be best used as key, since key is generated on-the-fly. Paper takes into consideration an encrypted image of 24 bits and shares of 32 bits, since the receiver should be able to differentiate between shares and actual encrypted image. This is done since sender sends all four images at one go. The receiver checks for number of bpp and accordingly chooses the image for decryption.

The main advantage of .NET framework 4.0 is implementation of TPL(task parallel library).Using TPL the work can be divided into tasks and these tasks can be executed in parallel across multiple cores. These tasks can be executed parallely if and only iff there exists no

dependencies in the tasks.

The advantage of using .NET framework 4.0 is the usage of lock and unlocks bits which helps to lock the area where pixel manipulation is done and finally image is unlocked after all processing. In this way, it is possible to directly access the memory address of pixels (which is faster)

rather than accessing the values of pixels.

No. of random numbers generated for each pixel=3. No. of pixels in image = (length*breadth) of image.

No. of random numbers generated for entire

image=3*length*breadth.

Other advantages of using .NET framework 4.0 is it compiles much faster, debugging is easier using Visual studio‟s debugger, GC frees the memory when no more references exist and thus solves issue of memory leaks and also decreases the burden of programmer to free the

memory.

(5)

International Journal of Emerging Technology and Advanced Engineering

Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 1, January 2013)

515

V. CONCLUSION

The procedure of encryption and decryption

implemented in this paper is considered to be having better security rather than other SKC methods, since we encrypt the image in two levels and secret key is encrypted into an image which is unique kind of data to image transformation concept put forward in this paper non-existent in other cryptographic methods. In encryption procedure, we have two levels of security and both are in different levels having security of their own. Firstly the intensity variation and secondly is pixel value swapping. Though an intruder by brute force technique is able to decrypt one of encryption second one is one more hurdle. However, brute force technique is possible only if there are few possibilities. But since random numbers are used as key, we have values ranging from 0 to 255 which is of utmost difficulty to find exact value ; 255 values for three random numbers of a pixel and then there are n number of pixels values to be found out.

In other visual cryptography or cryptography methods, the final output, though obtained correctly, is not clear enough[1]. This is one of the main drawbacks of other methods. But in this paper, regardless of ample number of manipulations done on a pixel value we get the original image back with same pixel colour value which was fed as input to algorithms. This is possible because we apply simple mathematics for manipulations.

The application of this cryptographic method can be exercised in the following way. This can be applied in an environment where a group of people need to know the secret information at a time as in a corporate office. A superior has the hold of encrypted image and rest of subordinates are given with shares. In that way none of subordinates can get back original image back without knowledge of encrypted image which is in custody of superior. In same way, even superior cannot retrieve back original image without the knowledge of subordinates; thus it can be concluded that both parties are dependent on each other for leaking the whole information.

REFERENCES

[1] M.Naor and A. Shamir, “Visual cryptography”. Advances in Cryptology EUROCRYPT ‟94.Lecture notes in Computer science. [2] F.liu, C.K.Wu , X.J.lin, “Color cryptography Schemes”.

[3] Liguo Fang, BinYu, “Research On Pixel Expansion Of(2,n) Visual Threshold Schemes”,1st International Symposium on Pervasive Computing and application ,pp. 856-860, IEEE.

[4] Jim cai, “Short survey on visual cryptography Schemes”-shares.

[5] http://en.wikipedia.org [6] http://msdn.microsoft.com

Figure

Fig. III:Pseudecode for Intensity Variation
Fig. IV:Pseudeocode for ‘One Swap Per Pixel’
Fig. VIII:Pseudocode for Creating Shares

References

Related documents

Abbreviations; CA, chronological age; HA, height age; BA, bone age; SA, sexual age; HPBI’, height prediction by Bayley-Pinneau; HPSMI, height prediction by sexual maturity index;

Two examples are shown in Figure 3 demonstrating the correlation of the true σ - ε curves derived from ABI tests and tensile data obtained from subsize miniature tensile specimens

A DURASPORT: Standard large-body shock with spring guide for pricing for special shocks are is found on the "Custom Shock Price List." ULTRASPORT: Rebound adjustable

graphic and Health Survey (DHS) of 2014 reported that 62% of mothers had early initiation of breastfeeding with mothers in the lowest wealth quintile more likely to initiate

Eingeschlossen wurden Patienten, die im Sinne dieser Studie positiv für eine Lumbopelvine Bewegungsstörung waren, also bei Vorliegen eines

The overrepresentation of males and minority students within special education classrooms is worrisome and has led to the hunt for an alternative method within schools that

An experimental strain life curve was determined as a base line for component specific evaluations and for comparison with the Langer and Chopra curves, which are the basis