Vous êtes sur la page 1sur 7

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No.

6 ISSN: 1837-7823

Compact Image Encryption Method for Flexible Security


G. Lokeshwari, gandrakoti@yahoo.com Associate Professor CSE, Auroras Engineering College, Bhongir Dr. S. Udaya Kumar, uksusarla@gmail.com Principal, MVSR Engineering College, Nadergul. A. Nikitha Reddy, nikitha0504@gmail.com, Auroras Engineering College, Bhongir T. Spoorthi, tspoorthireddy@yahoo.com , Auroras Engineering College, Bhongir

Abstract
Multimedia has become an inevitable part of any presentation. It has found a variety of applications right from entertainment to education. The evolution of internet has also increased the demand for multimedia content. Security and storage are the major concerns while transmitting multimedia content over the computer networks. This paper presents a new image encryption technique which ensures both security and storage efficiency. It involves substitution-based block cipher that considers an image to be encrypted as bit-stream. Key words: Image encryption, Block cipher, Compression, Types of compression, Block substitution.

1. Introduction
One of the main applications of image encryption is to transmit the image securely over the network such that no unauthorized user should be able to decrypt the image [4]. Image is a data type which requires enormous storage capacity or transmission bandwidth due to the large amount of data involved. As communication bandwidth and storage are limited, image is mostly subjected to compression after digitization. The basic objective of a data compression algorithm is to reduce the redundancy in data representation so as to decrease the data storage requirement. Data compression also provides an approach to reduce communication cost by effectively utilizing the available bandwidth. Data compression becomes important as file storage becomes a problem. In general, data compression consists of taking a stream of symbols and transforming them into codes. If the compression is effective, the resulting stream of codes will be smaller than the original symbols. To provide secure communication and ensure privacy, many image encryption algorithms have been proposed recently. In this paper, a new image encryption technique is introduced to achieve two goals efficiently i.e. security and storage efficiency. Security is achieved by block substitution, which induces high confusion to the intruder [3]. Lossless compression ensures storage efficiency and rate of compression completely depends on the pattern of image. This lossless compression has uses in medical, scientific and professional video processing applications.

2. Literature review 2.1 Title and Abstract 2.2 Document


2.2.1 Proposed method

33

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

In the proposed scheme, initially pixels are extracted from image. This stream of pixels is considered as source bitstream. The source bit-stream is decomposed into blocks of equal length i.e.8. From those blocks, distinct blocks are identified and for each distinct block, replaced code is generated [1][2]. These replaced codes are substituted in source bit-stream to get cipher bit-stream. Then key is formed based on information related to distinct blocks. Using key, cipher text is decrypted to produce source bit-stream, from which image is retrieved. It can be described by the figure1.

2.2.2 Encryption Algorithm


At first, sender converts an image into pixels i.e. source bit stream and decomposes into blocks of equal length; say L bits (where L is an integer and L 2). Step 1: Find out all distinct bit-stream-blocks of L bits length appeared in source bit-stream with their frequency of appearing. Say number of distinct blocks is N, So 0 N 2L-1 Step 2: Sort the distinct source-bit-stream blocks in ascending order with their frequency of appearance and keep set of distinct blocks with recently arranged order. Step 3: Generate Replaced Code, for each distinct block which are already kept into key. Step 4: Replace source bit stream with its corresponding Replaced Code. Then generate cipher bit-stream. 2.2.2.1 Replaced Code Generation Algorithm Step 1: Calculate the minimum number of bits for representing N, say n. Step 2: For all original blocks Bi (i holds position in set of all distinct blocks), check whether i<2n-1 or not and assume Replaced Code, RC = NULL. Step 3: Put Diff = 0 and calculate the following V = 2n-1 P = V/2 Step 4: If i<V, we put 0 at the right most position of RC and then concatenate (n-1) bits representation of (i-Diff) with recently generated Replaced Code at right end and it is Replaced code , RC for Bi, the original code of that blocks. Else put 1 at the right most position of RC. Step 5: If (V+P) > N Calculate required minimum number bits for representing (N-V), say C bits. Then concatenate C bits representation of binary form of (i-V), with recently generated incomplete Replaced Code, RC at right most places. Else (means V + P N) Diff =V V=V+P P=P2 n=n1 Go to Step 3 Step 6: Like this way, set of Replaced Code of all distinct blocks, occur in source bit-stream is formed. If N < (2L 2), then there are at least 2 blocks, of which length of Replaced Code is less than length of source block (i.e. L).

2.2.2.2 Key Generation Key plays a vital role in decryption process, as accurate key decrypts ciphertext to produce accurate plaintext. Key contains 3 segments. 1st segment denotes length of the blocks, while 2nd segment contains number of distinct blocks appeared in source bits stream, 3rd segment holds set of all distinct bit blocks with their proper length and sequence, that occurs in source bits stream.

34

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823 If L bit blocks is taken for encrypting source bit stream. Find out an integer; say d for which 2d-1 L 2d 1. Key structure is shown in table 1.

2.2.3 Decryption Algorithm


After receiving the target block and key, receiver comes to know information for each block, which was sending. After receiving the required information, the decryption authority performs the task of decryption. From key, receiver comes to know source block length, number of distinct blocks appeared in source bit stream, say N and obviously total set of distinct blocks in source bit stream with their sequence. Step 1: Calculate minimum number of bits, required to represent N, say n. 0 N 2L 1 and n L. Step 2:Calculate two integer C and P using following way: If N = 2L 1 or N = 2L 2 then C = 0 and P = L Else C = 1, V = 2n-1 increment = V/2, P = 0 While ((V + increment) <N) { V = V + increment increment = increment/2 C=C+1 } While (2P < (N V)) { P = P +1 } P = P +1 Step 3: Take next C bits stream from target bit stream. Step 4: If there is at least one 0 (ZERO) in those C bits stream then take next (n C) bits and append at last of those C bits steam, it is treated as K, means K is bit stream block. Else (means all C bits are 1 or C = 0) Take P next bits and append at last of those C bits steam, it is treated as cipher bit- stream block. Step 5: Replace the cipher bit-stream block with its corresponding original bit-stream block. Step 6: Repeat step4 and step5 till reaching the end of cipher bit-stream. Step 7: Convert the finally deciphered bit-stream into image.

2.2.4 Experimental results


2.2.4.1 32X32 image The stream of binary pixels, which is of length 1024 bits are extracted from the image ( of size 32X32) shown in the figure 1 as given below:
0000000000000111111111111111111100000000000001111111111111111111000000000000011111111111111111110000000000000001111 1111111111111000000000000000000111111111111110000000000000000000011111111111100000000000000000000001111111111000000 0000000000000000011111111100000000000000000000000111111111000000000000000000000001111111110000000000000000000000011 1111111000000000000000000000001111111110000000000000000000011111111111100000000000000000000111111111111000000000000 0000111111110000001100000000000000000000010111111111011000000000000000000011111111111110000000000000000110011111111 1111100000000000000111101111111111111000000000000000001111111111111110000000000000000111111111111111100000000000000 1111111111111111111000000000000011111111111111111111000000000000111111111111111111111000000000001111111111111111111 1100000000000111111111111111111111000000000000111110011111111111111000000000001111111111111111111110000000000001111 11111111111111110000000000001111111111111111111100000000000001111111111111111111000000000000011111111111

This stream of pixels is decomposed into blocks of 8- bit length. Distinct blocks are identified and sorted in ascending order according to their frequency of appearance. Then replaced code is computed for each distinct block as shown in the table 2. 35

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

After substituting replaced codes in source bit-stream, cipher is generated:


1001101011111010010000111110100110001111101001100011111010011000111110100110001111101001100011111010011010111110100 1101011111010011110100010100000001111000011001000011110001010000110111101010100010001111010101001011011110101010011 0101111010101001110011110010110011100111100110100111001111010011001110011110100110011100111101001100011101110011111 0001110111101111100110101111011111001101011110111110010110111101111100101101111

Rate of compression = (1- cipher bit-stream length /source bit-stream length)* 100 Here, Rate of compression = (1-508/1024)*100 Hence, an image is compressed approximately to 50%.
2.2.4.2 256x256 image

The stream of binary pixels, which is of length 65536 bits is extracted from the image ( of size 256X256). Distinct blocks and replaced codes are computed as shown in table 3. After substituting replaced codes in source bit-stream, cipher is generated (length 40945) Rate of compression = (1-40945/65536)*100 Hence, an image is compressed approximately to 38%. These experimental results are tabulated in table 4.

3. Figures and tables 3.1 Figures

Figure 1 : Block diagram of the proposed scheme

36

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

3.2 Tables
Table 1: Key Structure

Segment 1st

Size D

Description Binary form of L with d bits representation.

2nd

n bits binary form of the number of distinct blocks appeared in source-bitstream(count starts from 0).

3rd

L*N

All distinct blocks with their proper sequence and length ,i.e ,L

Table 2: Replaced Codes


S.no Distinct bloc 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 00000101 01100000 11100000 00011001 00111101 11111000 11111100 00011111 00000011 11111110 11110000 00000111 00000001 00001111 00111111 11111111 00000000 Frequen Replaced c 1 1 1 1 1 1 1 2 3 3 4 6 6 6 7 40 44 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10

37

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

Table 3: Replaced Codes


S.no 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 frequency 1 1 1 1 1 1 1 1 1 3 3 3 14 19 23 24 25 25 26 30 36 40 44 50 54 55 2112 5597

Table 4: Compression rate

S.no 1 2

Size of the image 32X32 256X256

Rate of compression(approx) 50% 38%

4. Conclusion and Future Scope


The proposed technique can be implemented on any size of the image. This technique not only encrypts the sourcebit stream but also storage efficient. The rate of compression depends on distinct blocks. Encryption with compression can also be achieved without sorting the distinct blocks in source bit-stream with their frequency. But in an attempt to increase the rate of compression during encryption without hampering the level of security, we sort the distinct blocks with their frequency in ascending order. There is a probability of having lesser number of bits in replaced codes for those original codes, which appear at the bottom of the sequence of the set of distinct blocks from the original bit-stream. So for sorting in ascending order of distinct blocks with the frequency of appearing, more frequently appeared blocks come in bottom of the sequence. Accordingly, in cipher more original blocks are replaced by the corresponding replaced codes which contain lesser bits than respective original codes. Obviously the rate of compression during encryption is higher. The proposed scheme can be extended for encrypting the video messages as well as sound encryption process.

38

International Journal of Computational Intelligence and Information Security, July 2012 Vol. 3, No. 6 ISSN: 1837-7823

References
[1]

[2]

[3] [4]

Pranam Paul, Saurabh Dutta, A K Bhattacharjee, Enhancement of Security through an Efficient Substitution-based Block Cipher of Bit-level Implementation with Possible Lossless Compression Vol. 8 No. 4 pp. 318-326. Pranam Paul, Saurabh Dutta, A. K. Bhattacherjee, An Approach to ensure Security through Bit-level Encryption with Possible Lossless Compression, International Journal of Computer Science and Network Security, Vol. 8 No. 2, pp 291 299. Bruce Schneier, Applied Cryptography, John Wiley & Sons (Asia) Pte Ltd, ISBN 9971-51-348-X. Digital Image Processing by Jayaraman, Esakkirajan and Veerakumar Tata McGraw Hill.

39