VLSI Implementation of Blowfish Algorithm For Secure Image Data Transmission
VLSI Implementation of Blowfish Algorithm For Secure Image Data Transmission
Abstract—Nowadays, almost every person in the world uses the Blowfish belongs in the category of symmetric block-cipher
Internet to communicate to each other. For various applications, algorithms; and can be used in place of conventional
different types of images are transmitted over the Internet. Such algorithms like DES or IDEA. The key used in the blowfish
photos normally contain either private or confidential data.
Ensuring the confidentiality, honesty, authentication and non-
algorithm can have a varying key-length with the minimum
repudiation of images during transmission is therefore a limit of 32 bits to maximum limit of 448 bits. Blowfish was
prerequisite for image transmission. Blowfish is an open source developed in 1993 with the aid of Bruce Schneier Blowfish is
algorithm thus making it available for anyone to use this in public domain and license-free [9-13].
algorithm for their desired purpose. Because of the fewer number The main functions performed in the blowfish algorithm that
of rounds and the operations used in the rounds being less keeps on repeating on each round consists of the following:
complex, blowfish is considered relatively a fast block cipher after
the key schedule has been completed. In this project, 1) Using the pre-initialized S-boxes and the appropriate
implementation of blowfish algorithm is done in MATLAB combination of the results from each of the S-boxes.
version 2019a. Verilog implementation is also done. 2) XOR operation performed on the right half of the input
which is 32-bit and the output of the function box, which is
Index Terms—Blowfish algorithm, Cryptography, MATLAB, also 32-bit.
Verilog HDL 3) Swapping of left and right sides of the output after
completing each round.
4) The left side of the input which is the output from the
I. INTRODUCTION
previous round is xor-ed with the p-array element for the given
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on October 30,2022 at 14:15:37 UTC from IEEE Xplore. Restrictions apply.
II. RELATED WORKS throughput] and selectivity in memory usage. The purpose of
The authors of paper [1] suggests an efficient method for paper [8] was to develop the most secure improved version of
ensuring security of the data in cloud servers. This paper gives blowfish algorithm (IMBFA); by introducing cell substitution
an analysis of the various existing cryptographic techniques function using “Wave Dynamic Differential Logic” (WDDL)
and the probabilities of attack that these techniques are not in order to prevent the hacker from estimating or predicting the
immune to. According to the authors, symmetric key key. In paper [9], the efficiency of the blowfish and modified
cryptographic techniques are way more efficient than the blowfish algorithm were evaluated using time, and avalanche.
asymmetric key cryptography. From various symmetric key After inspection, the modified blowfish algorithm is found to
cryptographic methodologies, the authors chose four most be slower with time taken for key generation, encryption, and
popular algorithms and compared the performances of these decryption processes turned out to be an average of “26.99ms,
algorithms with that of the proposed blowfish algorithm. From 1651.83ms, and 2765.04ms”; while that for ordinary blowfish
their study, they came across the conclusion that the DES algorithm, it was found to be “21.65ms, 1297.76ms, and
algorithm, which is considered to be the most primitive is 2176.59ms”.
more prone to attacks because of the small key-length. It is The difference was because of the difference in block size.
also found that the DES implementation is faster in hardware The implementation of 128-bit block size improves protection
but slower when done in the software as shown in Fig. 1. The by reducing the chances of duplication of blocks that have
authors of paper [2] were primarily aiming to address a chances of leaking information. The paper [10] presents the
solution to ensure the security of the data over the web. Here findings of a thorough analysis to re-search some of the most
also the authors came up with the idea of implementing widely used cryptographic encryption algorithms firstly to
blowfish algorithm for the same purpose. Here in addition to recognize as many of their weaknesses and vulnerabilities as
the already existing key used for the encryption and possible, and secondly to identify the aspects of those
decryption; they make use of an additional supplementary key weaknesses that can be avoided by proper implementation. In
to ensure more security to the system. This key from the paper [11] authors cited that for most modern steganography
encryptor side is send across the web to the decryptor via methods, information-hiding processes change almost all
email. Here they have implemented the algorithm using Java components of the covers. Hiding of data all over the image
language. The model was designed to process any type of can cause the visual quality of image to be reduced and can
images (i.e .jpg, .gmp, .png, etc). also lead to an increase in the chances for the loss of data
The authors of paper [3] brings up an idea of improvising because of possible cyber-attacks. The authors propose a new
the blowfish algorithm in-order to let it be capable of steganography method that is region-based [CR-BIS]; which
transmitting not only the plain-text but also the file contents. conceals data in the robust regions of the image.
The improvement helped to boost the efficiency of the In the project developed by authors of paper [12]; the
algorithm as a result of reduction in the number of rounds and receiver and the sender, both uses two large, prime numbers
also by, in selected rounds, increasing the length of the block that are identical, and use parametric equations to swap the
of data with fixed length during both encryption and values. Generated secret key using ASCII key matrix is used
decryption. The aim mentioned in paper [4] was to develop a for encryption and decryption. Playfair rules are applied to
hardware implementation of the blowfish algorithm for the encryption and decryption. It is a substitution cipher for
secured transfer of data over Internet of Things. Based on the digraphs. Playfair draws on sets of letters for decryption and
comparison performed between multiple cryptographic encryption. In paper [13], the authors present a solution to
algorithms, they have finalized with the blowfish algorithm overcome the problems of physically unprotected devices from
which was visibly better in performance and security than any which the hackers can get into the memory while the data
of the other algorithms. encryption is still being carried out. They demonstrated the
The main issue discussed in the paper [5] is the safety of need of a white-box based cryptography. In paper [14], the
wireless transmissions. One of the potential solutions to this authors introduced a reconfigurable, high performance
security problem is the Blowfish cryptographic algorithm. The hardware implementation for speech scrambling and
Blowfish algorithm was developed and implemented using the descrambling device which can be used in high-safety required
Xilinx ISE 14.5 development suite on the Virtex5 FPGA. In environments like in military. The scrambling algorithm was
paper [6], it is said that the said algorithms that are said to be developed based on the conventional DES algorithm with the
used to secure data in wireless networks against dangerous programming of a novel skew key. The listener will not be
attacks can also be used to secure data consuming resources able to understand the scrambled speech signal, but the audio
like encryption time, battery power, memory, C.P.U time etc. after recovery was found to be very clear.
The main concern in paper [7] was to provide protection for
software-level data transfers as well as for the hardware-level II. SYSTEM ARCHITECTURE
data through modified Blowfish Encryption and Decryption In blowfish algorithm there are two major parts that serves
algorithms. Compared to ordinary Blowfish and Triple-DES as the key elements of the method which are described and
algorithms, it gives minimal delay, higher speed, high shown in Fig. 2 as the following:.
0771
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on October 30,2022 at 14:15:37 UTC from IEEE Xplore. Restrictions apply.
Fig. 1. Block diagram.
1. Key expansion
2. Data encryption
In blowfish algorithm, the concept that stands out to make it
more secured than any other algorithms is the usage of variable
length keys. Blowfish algorithm can utilize the keys of size
varying from 32 buts to 448 bits. These keys are store in arrays
K1, K2, . . ., Kn; where each K will be having an input of 32
bits. Blowfish algorithm utilizes the p-array which is of 18 in
numbers and each component stores values with 32 bits each.
Each of the p-array elements were pre-initialized with the
hexadecimal form of the number pi, omitting the 3 before the
decimal point. These p-array elements are then XOR-ed with
the key array one by one and the values are store inside the p- Fig. 2. Blowfish algorithm (Encryption).
array itself. This will used inside the algorithm. Apart from p-
array blowfish also utilizes the four s-boxes which has 256
entries each. Each entry will be pre- initialized with the
hexadecimal values of pi.
A. Steps in blowfish encryption algorithm
1. Generation of subkeys:
The p-array consists of 18 members each of 32 bits. Each of
the p-array elements are pre-initialized with the 32-bit
hexadecimal form of the number pi. The number is taken in a
manner in which the first 32 bits number right after the
decimal point is stored in the P[1]. The following 32 bits are
stored in P[2]. Like this up to P[18] numbers are stored. After
pre-initializing the p-array, the next step is to modify this array
elements according to the user input key. The first element of
p-array is xor-ed with the key’s first 32 bits. Then, the next 32
bits is xor -ed with the second p-array element. The step is
continued till all the p-array elements are replaced.
Fig. 3. Function box.
2. Initialise Substitution Boxes: a. Rounds: The encryption consists of sixteen rounds. Input to
Initialization of the s-box is like that of p-array members. each round will be the plaintext and the p-array element
There are four s-boxes used in the algorithm. Each s-box corresponding to that round.
composed of 256 elements, each of 32 bits in size. All these b. Post processing: The function consists as shown in Fig. 3
elements are recorded with the hexadecimal form of pi. of the usage of the four s-boxes with 256 entries each. The
input to the function box will be the output of the XOR
3. Encryption: operation of p-array and left half of the data. So, the input to
The main parts of the encryption process using blowfish function box will be 32 bits of data. These 32 bits is divided
algorithm are the following: into four 8 bits and is accordingly given to the four s-boxes.
0772
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on October 30,2022 at 14:15:37 UTC from IEEE Xplore. Restrictions apply.
And the s-boxes uses these values as a look-up value to give
output corresponding to the values fed into it. Then the output
of the first two s-boxes of the function box are XOR-ed.
Further, this result and the output from s-box3 is then
performed modulo-2 addition. Then this will be further XOR-
ed with the output from the s-box4.
III. METHODOLOGY
The primary aim was to implement the blowfish algorithm
mathematically to get the desired results by giving a plain text
and image as inputs. After properly designing the blowfish
algorithm using MATLAB and verifying the results; the next
step was to implement it using Verilog and to verify the
outputs. For that first the Verilog implementation of blowfish
algorithm is done. The blowfish algorithm is implemented by
giving a plain-text as input give directly from the testbench.
After making the algorithm to work accordingly, the next step
was to give input as image. For this at first the required input
image is fed to the MATLAB and converted the image pixels Fig. 6. Input image to MATLAB.
into matrices. This data is made to be stored inside a file. Then
the file is opened in Verilog and algorithm is performed with
this data as input. Since blowfish works only for 64 buts data.
The algorithm was performed by dividing the data to 64 bits
blocks. After the encryption, the data is stored in another file
to which is opened and converted to image in MATLAB.
Similar process is done for the decrypted output also.
0773
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on October 30,2022 at 14:15:37 UTC from IEEE Xplore. Restrictions apply.
Fig. 12. Decrypted Image.
V. CONCLUSION
Blowfish algorithm is a symmetric key algorithm which has
Fig. 8. Decrypted Image. 16 rounds feistal structure. The main parts of a blowfish
algorithm are key expansion and data encryption. The
algorithm has an array of user defined keys which can be of
size varying from the minimum required as 32 bits to the
maximum limit of 448 bits. The input to the blowfish
algorithm will be a plain text of size 64-bit and output will be
64-bit cypher text; which is nothing but the encrypted data.
Here in this project, at first the blowfish algorithm is
implemented using MATLAB by giving a string and image as
two separate inputs. Then the same is performed using Verilog
HDL; and the results in both cases are verified.
Fig. 9. Input image to MATLAB.
REFERENCES
[1] D. R. S. P. R. Vasantha, “An advanced security analysis by using
blowfish algorithm," (IJSRCSEIT) 2017.
[2] K. K. M. Mekala, “Enhanced blowfish algorithm for image encryption
and decryption with supplementary key," July 2016.
[3] B. D. G. Godfrey L Dulla and R. P. Medina, “A unique message
encryption technique based on enhanced blowfish algorithm," 2019.
[4] N. M. Manju Suresh, \Hardware implementation of blowfish algorithm
for the secure data transmission in internet of things."
[5] B. P. M. C. Swagata Roy Chatterjee, Soham Majumder, “Fpga
implementation of pipelined blowfish algorithm," 2014.
[6] C. M. K. S. Gurjeevan Singh, et al, “Superiority of blowfish algorithm in
wireless networks," vol. Volume 44{No11, April 2012.
[7] P. B. V. Kumara Swamy, \Predominance of blowfish algorithm over
TDES for secure integrated circuits," vol. Vol.9, No.6, November 2017.
Fig. 10. Verilog Simulation result. [8] P. B. Kumara swamy Varukthi, “Vlsi design ow for secure integrated
circuits based on des, TDES, AES and blowfish algorithms and their
performance," 2018.
[9] M.Rajalakshmi, H.S.RajyaSree, V.Nagarajan 2014, “VLSI
Implementation of RC4 Stream Cipher Using Hardware Pipelining” Int
J of Electronic Com Engg Advanced Research, 2(1), pp. 66-71
[10] R. P. M. Theda Flare et al Modified blowfish algorithm," Oct 2018.
[11] P. B. V. Kumara Swamy, “Predominance of blowfish over triple data
encryption standard symmetric key algorithm for secure integrated
circuits using verilog hdl," November 2017.
[12] R. K. K. Ramesh Yigereddy, “A survey on conventional encryption
algorithms of cryptography."
[13] K. B. J. Santhosh et al, “Symmetric key based encryption and
decryption using lissajous curve equations”, Int Jou of Elec and Comp
Eng , vol. 7, pp. 285-288, 2017.
[14] Saha and Srinivasan, C., “White-Box cryptography-based data
encryption-decryption scheme for IoT environment”, in 2019 5th Inter.
Conf. on Adv. Comp. and Com. Sys, ICACCS 2019, 2019, pp. 637-641.
Fig. 11. Encrypted image. [15] Ea John, Remya Ajai A S, and Poornachandran Pb, “Effective
implementation of des algorithm for voice scrambling”, Com. in Comp
Decrypted output from Verilog is again fed back to and Info Sci, vol. 335 CCIS, pp. 75-84, 2012
MATLAB to get the image output shown Fig. 9, Fig. 10, Fig.
11 and Fig. 12
0774
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on October 30,2022 at 14:15:37 UTC from IEEE Xplore. Restrictions apply.