0% found this document useful (0 votes)
120 views

Image Encryption and Decryption Using BL PDF

The document summarizes a study that encrypted and decrypted images using the Blowfish encryption algorithm. Key points: 1. The Blowfish algorithm was used to encrypt images due to its strength, speed, and large key size compared to other algorithms like DES and AES. 2. Blowfish is a symmetric block cipher that encrypts data in 64-bit blocks using a key-dependent schedule and Feistel network with 16 rounds. 3. For encryption, an image is divided into 64-bit blocks which are then encrypted using Blowfish. The header is excluded from encryption.

Uploaded by

Animesh Prasad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Image Encryption and Decryption Using BL PDF

The document summarizes a study that encrypted and decrypted images using the Blowfish encryption algorithm. Key points: 1. The Blowfish algorithm was used to encrypt images due to its strength, speed, and large key size compared to other algorithms like DES and AES. 2. Blowfish is a symmetric block cipher that encrypts data in 64-bit blocks using a key-dependent schedule and Feistel network with 16 rounds. 3. For encryption, an image is divided into 64-bit blocks which are then encrypted using Blowfish. The header is excluded from encryption.

Uploaded by

Animesh Prasad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

World Journal of Science and Technology 2012, 2(3):151-156

ISSN: 2231 – 2587


Available Online: www.worldjournalofscience.com

_________________________________________________________________
Proceedings of "National Conference on Emerging Trends in Information Technology (NCETIT-2012)"
Held at R.C.Patel Institute of Technology, Shirpur, Dist. Dhule,Maharashtra,India.
April 21, 2012

Image encryption and decryption using blowfish algorithm


Irfan.Landge1, Burhanuddin Contractor2, Aamna Patel3 and Rozina Choudhary4

1Assistant Professor, Electronics Department, M.H. Saboo Siddik College of Engineering, Mumbai University, Mumbai, India
2,3,4Electronics Department, M.H. Saboo Siddik College of Engineering, Mumbai University, Mumbai, India

Abstract
This paper is about encryption and decryption of images using a secret-key block cipher called 64-bits Blowfish which is an
evolutionary improvement over DES, 3DES, etc designed to increase security and to improve performance. This algorithm
will be used as a variable key size up to 448 bits. It employs Feistel network which iterates simple function 16 times.
Specifically, in this algorithm, a combination of four S-boxes lookups, multiplications as well as fixed and data dependent
rotations will be used. In this paper we would be obtaining our results by simulating the image processing part in MATLAB &
encryption and decryption part in VHDL for better security.

Keywords:Blowfish, Cryptography, Image Encryption, Image Decryption, Feistel Network, Block Cipher.

INTRODUCTION
science of protecting information by encoding it into an unreadable
In the past few years the security and integrity of data is the format. It is an effective way of protecting sensitive information as it
main concern. In the present scenario almost all the data is is stored on media or transmitted through network communication
transferred over computer networks due to which it is vulnerable to paths.
various kinds of attacks. To make the data secure from various To encrypt the data various cryptographic algorithms such
attacks and for the integrity of data we must encrypt the data before DES, 3DES, blowfish, AES, etc are used. So we are implementing
it is transmitted or stored. Government, military, financial institution, blowfish algorithm which is strongest and fastest in data
hospitals and private business deals with confidential images about processing/storing compare to other algorithms which is mentioned
their patient (in Hospitals) , geographical areas(in research ) ,enemy above. Blowfish algorithm is highly secured because it has longer
positions (in defense), product , financial status. Most of this key length (more no of key size). The philosophy of proposal
information is now collected and stored on electronic computers and algorithm is to use the full menu of “Strong operations” supported in
transmitted across network to other computer. If these confidential modern computers to achieve better security properties and provide
images about enemy positions, patient and geographical areas fall high speed. The main aim behind the design of this proposal is to get
into the wrong hands, than such a breach of security could lead to the best security/performance tradeoff over existing ciphers. Here we
declination of war, wrong treatment etc. Protecting confidential would be considering a Tagged image file format (TIF).
images is an ethical and legal requirement.
We store information in computer system in the form of files. BLOWFISH ALGORITHM
File is considered as a basic entity for keeping the information.
Therefore the problem of securing image data or information on Blowfish is a symmetric block cipher that encrypts data in 8-
computer system can be defined as the problem of securing file data. byte (64-bit) blocks. The algorithm has two parts, key expansion and
It is word wide accepted fact that securing file data is very important, data encryption. Key expansion consists of generating the initial
in today’s computing environment. contents of one array (the P-array), namely, eighteen 32-bit sub-
Cryptography is a method of storing and transmitting data in a keys, and four arrays (the Sboxes), each of size 256 by 32 bits, from
form that only those, it is intended for can read and process. It is a a key of at most 448 bits (56 bytes). The data encryption uses a 16-
round Feistel Network.

 The F function
*Corresponding Author
Figure 1 shows a block diagram of an algorithm with the
Irfan Landge Feistel structure for encryption, with 16 rounds of confusion and
Assistant Professor, Electronics Department, M.H. Saboo Siddik College of diffusion. Mathematically the functions can be expressed as below:
Engineering, Mumbai University, Mumbai, India Take a block of 64 bits and divide it into two equal halves: L and R.
Then define the iterated block cipher when the outputs Li and Ri of
Email: [email protected]
152 Landge, Patel and Choudhary

the i'th round are determined from the outputs Li-1 and Ri-1 of the The addresses a, b, c and d are 8-bits wide, while the S-box outputs are
previous round: 32-bits wide.
Li = Li-1 The process of data encryption can be described as in the
Ri = Li-1 F (Ri-1, Ki) pseudo code below:
where Ki is the sub-key used in the ith round and F is specific to the Divide X into two 32-bit halves XL and XR
particular algorithm. For i=1 to 16:
XL = XL Pi
XR = F (XL) XR
Swap XL and XR
End for
Swap XL and XR (Undo the last swap.)
XR = XR P17
XL = XL P18
Recombine XL and XR
Output X (64-bit data block: cipher text)
For decryption, the same process is applied, except that the
sub-keys Pi must be supplied in reverse order. The nature of the
Feistel network ensures that every half is swapped for the next round
(except, here, for the last two sub-keys P17 and P18).

IMAGE ENCRYPTION & DECRYPTION ANALYSIS

 Encryption Process

Data image as a plaintext and the encryption key are two


inputs of encryption process.

Fig 3: Image Encryption


Fig 1: Flow of Encryption
In this case, original image data bit stream is divided into the
The F Function, regarded as the primary source of algorithm
blocks length of Blowfish algorithm. Image header is excluded to
security, combines two simple functions: addition modulo two (XOR)
encrypt and the start of the bitmap pixel or array begins right after
and addition modulo 232.
the header of the file. The byte elements of the array are stored in
row order from left to right with each row representing one scan line
of the image and the rows of the image are encrypted from top to
bottom.

 Decryption Process

The encrypted image is divided into the same block length of


Blowfish algorithm from top to bottom.

Fig 2: F function

The F function is the kernel and distinguishing feature of Blowfish,


and is applied as follows:
Divide XL (32 Bits) into four 8-bit quarters: a, b, c, and d. Then: Fig 4: Image Decryption
F (XL) = {(S1[a] + S2[b]) S3[c]} + S[d] )},
The first block is entered to the decryption function and the
Where + means addition modulo 232, and means exclusive OR, same encryption key is used to decrypt the image but the application
i.e. XOR S1[a], for example, means the content of S-box 1 at address a.
World Journal of Science and Technology 2012, 2(3):151-156 153

of sub keys is reversed. The process of decryption is continued with


other blocks of the image from top to bottom.

SIMULATION AND RESULTS

In this paper we have simulated the image processing part in


MATLAB & encryption & decryption part in VHDL.

 Case 1: Here we would be taking a black & white image of


size 32x64. Firstly we would be obtaining binary matrix of
the chosen image & then we would be encrypting the
image matrix using blowfish algorithm.

MATLAB oriented results:

Fig 6: Encryption-1
Encrypted Output 1: F724DCE39143E75D

The input text consists of bits. The Encrypted output is of 16 bytes.

Fig 7: Decryption-1
Decryption Output 1: 0607998404E1B33C
Fig 5: Black & White Images
Plaintext (Input) 2: CFC982019FF00738
The above result shows the original image, encrypted image Here row 4 is been considered for the plaintext. Row 4 comprises of
& the decrypted image. We can clearly see that the decrypted image 64 bits.
is same as the original image.

VHDL oriented results:


The result shows the Encryption & Decryption of separate
rows of original image matrix using blowfish algorithm. Here we are
focusing on two results of encryption & decryption of two individual
rows respectively & similarly all rows are been encrypted &
decrypted.
Plaintext (Input) 1: 0607998404E1B33C
Here row 1 is been considered for the plaintext. Row 1 comprises of
64 bits.

Fig 8: Encryption-2
Encrypted Output 2: 3EEAC76656B872E3
154 Landge, Patel and Choudhary

The input text consists of bits. The Encrypted output is of 16 bytes. Here row 17 is been considered for the plaintext. Row 17 comprises
of 64 bits.

Fig 11: Encryption-1


Encrypted Output 1: F0ACBA98D84D5971
Fig 9: Decryption-2
Decryption Output 2: CFC982019FF00738 The input text consists of bits. The Encrypted output is of 16 bytes.
 Case 2: Here we would be taking a colour image of size
64x64. Firstly we would be obtaining binary matrix of the
chosen image & then we would be encrypting the image
matrix using blowfish algorithm.

MATLAB oriented results:

Fig 12: Decryption-1


Decryption Output 1: 018FFFFFFFFFF000

Plaintext (Input) 2: 3FFFFFFFFFFFFFF0


Here row 28 is been considered for the plaintext. Row 28 comprises
of 64 bits.

Fig 10: Colour Images

The above result shows the original image, encrypted image


& the decrypted image. We can clearly see that the decrypted image Fig 13: Encryption-2
is same as the original image. Encrypted Output 2: CEDCBA98937EC6C8

VHDL oriented results:


The result shows the Encryption & Decryption of separate
rows of original image matrix using blowfish algorithm. Here we are
focusing on two results of encryption & decryption of two individual
rows respectively.

Plaintext (Input) 1: 018FFFFFFFFFF000


The input text consists of bits. The Encrypted output is of 16 bytes.
World Journal of Science and Technology 2012, 2(3):151-156 155

Different images have been tested by the proposed image


encryption procedure. It is clear that the histogram of the encrypted
image is less dynamic and significantly different from the respective
histograms of the original image. So, the encrypted image does not
provide any clue to employ any statistical attack on the proposed
encryption of an image procedure, which makes statistical attacks
difficult. These properties tell that the proposed image encryption has
high security against statistical attacks. In the original image (i.e.
plain image), some gray-scale values at 0 & 255 are still not existed,
but every gray-scale values at 0 & 255 exist and give low dynamicity
in the encrypted image.

CONCLUSION

Both colour and black & white image of any size saved in
Fig 14: Decryption-2 tagged image file format (TIF) can be encrypted & decrypted using
Decryption Output 2: 3FFFFFFFFFFFFFF0 blowfish algorithm. Histogram of encrypted image is less dynamic
and significantly different from the respective histograms of the
HISTOGRAM ANALYSIS original image. Blowfish cannot be broken until an attacker tries
28r+1 combinations where r is the number of rounds. Hence if the
Here the original image and its corresponding encrypted number of rounds are been increased then the blowfish algorithm
image and their histograms of black & white images and colour becomes stronger. Since Blowfish has not any known security weak
images respectively are shown in fig 15 and fig 16. points so far it can be considered as an excellent standard
encryption algorithm.

REFERENCES

[1] Ashwaq Talib Hashim, FPGA Simulation of Type-3 Feistel


Network of The 128 bits Block Size Improved
BlowfishfCryptographic Encryption, Eng & Tech .Journal,
Vol.28, No.9, 2010,pp 115-119.
[2] Atul, Kahate, Cryptography and Network Security, (Second
Edition 2008).
[3] Bruce Schneier, Applied Cryptography: Protocols, Algorithms,
and Source Code in C, (Second edition, 1996).
[4] Bruce Schneier, Description of a New Variable-Length Key, 64-Bit
Block Cipher (Blowfish), Cambridge Security Workshop on Fast
Software Encryption, Cambridge, UK, December 9-11, 1993,pp
191-204.
[5] Dr. V Ramaswamy, Krishnamurthy G N, “Performance Analysis of
Fig 15: Histogram of Black & White Images
Blowfish and its Modified Version using Encryption quality, Key
sensitivity”, International Journal of Recent Trends in Engineering,
Vol. 1, No. 2, May 2009, pp. 1-4.
[6] H. Cheng, X.B. Li, “Partial encryption of compressed image and
videos”, IEEE Trans. Signal Process. 2008 48(8),pp. 2439-
2451.
[7] Irfan Abdulgani Landge, Implementation of AES Encryption &
Decryption using VHDL, International J. of Engg. Research &
Indu.Appls. (IJERIA). ISSN 0974-1518, Vol. 4, August 2011,pp
395-406.
[8] James M noras, Optimal Datapath Design for a Cryptographic
Processor: The Blowfish Algorithm, Malaysian Journal ssof
Computer science, Vol .14 No.1, June 2001,pp 16-27.
[9] John Farack, Reconfigurable Multi-core Crypto-processor for
Multichannel Communication Systems. Eng & Tech Journal,
Vol.2, No.3, 2008, pp 130-139.
[10] Lepakshi goud.T, Dynamic routing with Security using a Blow
fish Algorithm in the multiple Organizing system, IJAEST, vol No
Fig 15: Histogram of Colour Images .4,issue No 1, 2011,1-9.
156 Landge, Patel and Choudhary

[11]Simar Preet Singh, Comparison of Data Encryption Algorithm, BLOW FISH Algorithm”,International Conference on Electronics
IJCSC, Vol 2 No.1, June-2011,pp 125-127. Communication and Instrumentation and Control
[12] Irfan Abdul Gani landge, Burhannudin Contractor Tauseef Engineering,2012,pp 34.
Companywala, “VHDL Based Encryption and Decryption using

You might also like