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

Image Encryption and Decryption Using BL PDF

The document summarizes research on encrypting and decrypting images using the Blowfish encryption algorithm. It describes how the Blowfish algorithm works, including using a Feistel network structure with 16 rounds, key expansion, and substitution boxes. It then discusses encrypting and decrypting images by dividing them into blocks to encrypt with Blowfish and presents results encrypting and decrypting sample black-and-white and color images using MATLAB for image processing and VHDL for encryption/decryption.

Uploaded by

Naresh Purohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views

Image Encryption and Decryption Using BL PDF

The document summarizes research on encrypting and decrypting images using the Blowfish encryption algorithm. It describes how the Blowfish algorithm works, including using a Feistel network structure with 16 rounds, key expansion, and substitution boxes. It then discusses encrypting and decrypting images by dividing them into blocks to encrypt with Blowfish and presents results encrypting and decrypting sample black-and-white and color images using MATLAB for image processing and VHDL for encryption/decryption.

Uploaded by

Naresh Purohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
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
Department, M.H. Saboo Siddik College of Engineering, Mumbai University, Mumbai, India

2,3,4Electronics

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
In the past few years the security and integrity of data is the
main concern. In the present scenario almost all the data is
transferred over computer networks due to which it is vulnerable to
various kinds of attacks. To make the data secure from various
attacks and for the integrity of data we must encrypt the data before
it is transmitted or stored. Government, military, financial institution,
hospitals and private business deals with confidential images about
their patient (in Hospitals) , geographical areas(in research ) ,enemy
positions (in defense), product , financial status. Most of this
information is now collected and stored on electronic computers and
transmitted across network to other computer. If these confidential
images about enemy positions, patient and geographical areas fall
into the wrong hands, than such a breach of security could lead to
declination of war, wrong treatment etc. Protecting confidential
images is an ethical and legal requirement.
We store information in computer system in the form of files.
File is considered as a basic entity for keeping the information.
Therefore the problem of securing image data or information on
computer system can be defined as the problem of securing file data.
It is word wide accepted fact that securing file data is very important,
in todays computing environment.
Cryptography is a method of storing and transmitting data in a
form that only those, it is intended for can read and process. It is a

science of protecting information by encoding it into an unreadable


format. It is an effective way of protecting sensitive information as it
is stored on media or transmitted through network communication
paths.
To encrypt the data various cryptographic algorithms such
DES, 3DES, blowfish, AES, etc are used. So we are implementing
blowfish algorithm which is strongest and fastest in data
processing/storing compare to other algorithms which is mentioned
above. Blowfish algorithm is highly secured because it has longer
key length (more no of key size). The philosophy of proposal
algorithm is to use the full menu of Strong operations supported in
modern computers to achieve better security properties and provide
high speed. The main aim behind the design of this proposal is to get
the best security/performance tradeoff over existing ciphers. Here we
would be considering a Tagged image file format (TIF).
BLOWFISH ALGORITHM
Blowfish is a symmetric block cipher that encrypts data in 8byte (64-bit) blocks. The algorithm has two parts, key expansion and
data encryption. Key expansion consists of generating the initial
contents of one array (the P-array), namely, eighteen 32-bit subkeys, and four arrays (the Sboxes), each of size 256 by 32 bits, from
a key of at most 448 bits (56 bytes). The data encryption uses a 16round Feistel Network.


*Corresponding Author
Irfan Landge
Assistant Professor, Electronics Department, M.H. Saboo Siddik College of
Engineering, Mumbai University, Mumbai, India
Email: irfan.mailbox@gmail.com

The F function

Figure 1 shows a block diagram of an algorithm with the


Feistel structure for encryption, with 16 rounds of confusion and
diffusion. Mathematically the functions can be expressed as below:
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

Landge, Patel and Choudhary

152

the i'th round are determined from the outputs Li-1 and Ri-1 of the
previous round:
Li = Li-1
Ri = Li-1
F (Ri-1, Ki)
where Ki is the sub-key used in the ith round and F is specific to the
particular algorithm.

The addresses a, b, c and d are 8-bits wide, while the S-box outputs are
32-bits wide.
The process of data encryption can be described as in the
pseudo code below:
Divide X into two 32-bit halves XL and XR
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

The F Function, regarded as the primary source of algorithm


security, combines two simple functions: addition modulo two (XOR)
and addition modulo 232.

In this case, original image data bit stream is divided into the
blocks length of Blowfish algorithm. Image header is excluded to
encrypt and the start of the bitmap pixel or array begins right after
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:
F (XL) = {(S1[a] + S2[b])

S3[c]} + S[d] )},

Where + means addition modulo 232, and


means exclusive OR,
i.e. XOR S1[a], for example, means the content of S-box 1 at address a.

Fig 4: Image Decryption

The first block is entered to the decryption function and the


same encryption key is used to decrypt the image but the application

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 5: Black & White Images

The above result shows the original image, encrypted image


& the decrypted image. We can clearly see that the decrypted image
is same as the original image.

Fig 7: Decryption-1
Decryption Output 1: 0607998404E1B33C
Plaintext (Input) 2: CFC982019FF00738
Here row 4 is been considered for the plaintext. Row 4 comprises of
64 bits.

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

Landge, Patel and Choudhary

154

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

Fig 9: Decryption-2
Decryption Output 2: CFC982019FF00738


Here row 17 is been considered for the plaintext. Row 17 comprises


of 64 bits.

Fig 11: Encryption-1


Encrypted Output 1: F0ACBA98D84D5971

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
is same as the original image.

Fig 13: Encryption-2


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
Fig 14: Decryption-2
Decryption Output 2: 3FFFFFFFFFFFFFF0

HISTOGRAM ANALYSIS
Here the original image and its corresponding encrypted
image and their histograms of black & white images and colour
images respectively are shown in fig 15 and fig 16.

Both colour and black & white image of any size saved in
tagged image file format (TIF) can be encrypted & decrypted using
blowfish algorithm. Histogram of encrypted image is less dynamic
and significantly different from the respective histograms of the
original image. Blowfish cannot be broken until an attacker tries
28r+1 combinations where r is the number of rounds. Hence if the
number of rounds are been increased then the blowfish algorithm
becomes stronger. Since Blowfish has not any known security weak
points so far it can be considered as an excellent standard
encryption algorithm.
REFERENCES
[1]

Fig 15: Histogram of Black & White Images

Fig 15: Histogram of Colour Images

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
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. 24392451.
[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
.4,issue No 1, 2011,1-9.

156

[11]Simar Preet Singh, Comparison of Data Encryption Algorithm,


IJCSC, Vol 2 No.1, June-2011,pp 125-127.
[12] Irfan Abdul Gani landge, Burhannudin Contractor Tauseef
Companywala, VHDL Based Encryption and Decryption using

Landge, Patel and Choudhary

BLOW FISH Algorithm,International Conference on Electronics


Communication
and
Instrumentation
and
Control
Engineering,2012,pp 34.

You might also like