12.07.2015 Views

fpga implementation of modified blowfish algorithm - IRNet Explore

fpga implementation of modified blowfish algorithm - IRNet Explore

fpga implementation of modified blowfish algorithm - IRNet Explore

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FPGA IMPLEMENTATION OF MODIFIED BLOWFISH ALGORITHMAKSHATHA.B.R 1 , AMITABHA.K.KUMAR 2 , NEHA CHOUBEY 3 , JAMUNA.S 4 ,RAJA JITENDRA NAYAKA 51,2,3,4 Department <strong>of</strong> Electronics and Communications, Dayananda Sagar College <strong>of</strong> Engineering, Bangalore, India5 R&D, ITI Ltd. Bangalore, India.Abstract- This paper focuses on implementing <strong>modified</strong> <strong>blowfish</strong> <strong>algorithm</strong> on FPGA using a hardware descriptionlanguage such as VHDL. Encryption <strong>algorithm</strong> plays a major role in network application and data security systems. Butsecuring data consumes a major amount <strong>of</strong> resources such as CPU time and battery power. We also focus on improvising theperformance and security provided by the <strong>blowfish</strong> encryption <strong>algorithm</strong>. With advancement in technology, DES is found tobe no longer secure. As a drop-in replacement for DES, <strong>blowfish</strong> encryption <strong>algorithm</strong> can be used. The <strong>blowfish</strong> <strong>algorithm</strong>which was originally 64-bit block cipher is transformed into 128-bit block cipher. This paper also proposes variousmodifications in the <strong>blowfish</strong> <strong>algorithm</strong> such as a new logic has been incorporated instead <strong>of</strong> just replicating the bits in thekey expansion part. In Blowfish <strong>algorithm</strong> there are four S boxes each with 256 entries which consume a memory space.Hence this paper proposes an alternative to replace these boxes with AES S box and mix column techniques. This alsoreduces the memory consumption as S box is dynamically generated and only multiplicative inverse box is stored.Index Terms- S box, Encryption ,Decryption, Feistel Network.I. INTRODUCTIONCryptography is referred to as study <strong>of</strong> secret. This isa process where a readable message is converted intoa form which is unreadable to others except for theone it is intended to. Whenever confidentialinformation is sent, there is possibility <strong>of</strong> anunauthorized third party attack in order to learn theconfidential information [6].Cryptography includes two basic components:-encryption <strong>algorithm</strong> and keys. If the sender andrecipient use the same key then it is known assymmetric or private key cryptography. It is mostsuitable for long data streams. It is difficult toimplement in practice as it is necessary for bothsender and receiver to know the key. Moreover thekeys must be sent over a secure channel from senderto the receiver. The question behind is that if such asecure channel is already present, why not send thedata directly over the secure channel. On the otherhand if different keys are used then it is known asasymmetric or public key cryptography. It is useful forshort data streams.Blowfish was designed by Bruce Schneider in 1993as a fast, free alternative to existing encryption<strong>algorithm</strong>s which was the Federal InformationProcessing Standard Cryptography (FIPS Crypto) [1][2]. The <strong>algorithm</strong> is safe against unauthorized attackand runs faster than the popular existing <strong>algorithm</strong>.The concept <strong>of</strong> <strong>blowfish</strong> is very simple to understandbut its actual <strong>implementation</strong> and the use <strong>of</strong> <strong>algorithm</strong>in real time is very complex. Blowfish is a symmetricblock cipher which can be used for encrypting andsafeguarding the data effectively. Blowfish has afixed 64-bit block size. Blowfish has variable lengthkey, from 32 bits to 448 bits. Blowfish <strong>algorithm</strong> is aFeistel Network, iterating a simple encryptionfunction 16 times. It consists <strong>of</strong> a complexinitialization phase which is required before anyencryption can take place. The actual encryption <strong>of</strong>data is very efficient on large microprocessors. As<strong>blowfish</strong> is a variable length key block cipher, it ismost suitable for applications where the key does not<strong>of</strong>ten change such as a communications link or anautomatic file encryptor [7]. Horst Feistel publishedan article on Feistel Network in 1973. Mostsymmetric block ciphers use Feistel Network for theirconstruction. A Feistel Network is said to be aniterative network which consists <strong>of</strong> an internalfunction called as round function. It is a methodwhere the round function (also called as F-function)is transformed into permutation. The Feistel Networkworking can be summarized as follows:- The input data is split into two equal halves. The right half <strong>of</strong> input data becomes the newleft half. The round function (F-function) is applied tothe right half <strong>of</strong> input data and the key. The output <strong>of</strong> the F-function is then xored withthe left half <strong>of</strong> input data. The output from the xor operation is the newright half. The new right half and the new left halfbecomes the Feistel Network output [7].Figure 1: Feistel Network.International Conference on Electronics and Communication Engineering, 28 th April-2013, Bengaluru, ISBN: 978-93-83060-04-744


II. LITERATURE SURVEY OF BLOWFISHBASED ALGORITHMSBlowfish <strong>algorithm</strong> as mentioned earlier is a 64-bitblock cipher. It has variable length key varying from32 to 448 bits. The <strong>algorithm</strong> consists <strong>of</strong> two parts:key expansion part and data encryption part. Keyexpansion part converts key which can be maximum<strong>of</strong> 448 bits into several sub-key arrays <strong>of</strong> total 4168bytes [1].Data encryption part is executed by a 16 round FeistelNetwork. In each round there is a key dependentpermutation and key and data dependent substitution.The operations are usually xor and modulo additionon 32-bit words. Additional operations include fourindexed array data lookups per round. It has followingelements: P-array (Permutation array which performsshuffling or mixing). S-boxes (Substitution boxes which performsnonlinear functions) [2].FPGA Implementation <strong>of</strong> Modified Blowfish Algorithmobtained. This output is xored with the righthalf <strong>of</strong> the data and right half <strong>of</strong> the data isupdated.Swap the left half and right S-boxes andfinally round function (F) output is obtained.This output is xored with the right half <strong>of</strong> thedata and right half <strong>of</strong> the data is updated.Swap the left half and right half <strong>of</strong> data.Repeat step 2 and 3 for 15 more times.After the sixteenth round, swap the left halfand right half to undo the last swap.The right half is xored with seventeenthelement <strong>of</strong> P-array and the left half is xoredwith eighteenth element <strong>of</strong> P-array. Updatethe right half and left half respectively.Finally combine the left half and right half toobtain the cipher text [5].F-function splits the 32-bit into four 8-bits and each 8-bit is applied as input to each S-boxes. The output <strong>of</strong>first two S-boxes is xored and the xored output ismodulo added (2^32) with the output <strong>of</strong> third S-box.This output is then xored with the output from fourthS-box. This is the final F-function 32-bit output.Since <strong>blowfish</strong> is a Feistel Network, it can be simplyinverted by xoring P17 and P18 with the cipher textblock and then using the entries <strong>of</strong> P-array in reverseorder. This is decryption <strong>of</strong> cipher text in order toobtain the original input data.Figure 2: The Blowfish Algorithm.Sub-keys must be pre-computed before dataencryption and decryption. There are 18 32-bit subkeysin P-array from P1, P2….P18 and four 32-bit S-boxes each consisting <strong>of</strong> 256 elements i.e. S1,0S1,1….S1,256. S2,0 S2,1….S2,256. S3,0S3,1….S3,256. S4,0 S4,1….S4,256.Blowfish has 16 rounds. The <strong>algorithm</strong> works asdescribed below: The input is a 64-bit data element, x. Dividex into two halves each <strong>of</strong> 32-bits, the left half(xL) and right half (xR). Xor the left half <strong>of</strong> the data with the P-arrayand update the left half <strong>of</strong> the data. The result obtained in step 2 is sent to the S-boxes and finally round function (F) output isFigure 3: F-function in Feistel Network.III. PROPOSED METHOD FOR MODIFIEDALGORITHMThe original <strong>blowfish</strong> <strong>algorithm</strong> is proposed to havethe following changes so as to implement the sourcecode on FPGA and also to try and strengthen the<strong>algorithm</strong>. The three changes proposed are in,1. Key expansion.2. Extension to 128 bit.3. F-function.International Conference on Electronics and Communication Engineering, 28 th April-2013, Bengaluru, ISBN: 978-93-83060-04-745


A. KEY EXPANSIONIn original <strong>blowfish</strong> <strong>algorithm</strong>, the input key wassimply replicated to get a key <strong>of</strong> 448 bits. Here, in thispaper we propose the replication <strong>of</strong> bits by using thefollowing logic as mentioned in figure 4. Hence weget a key which is no longer a replica <strong>of</strong> same bits.The purpose <strong>of</strong> this is to make the cryptanalysis <strong>of</strong> thekey to become more difficult.FPGA Implementation <strong>of</strong> Modified Blowfish Algorithm IP (95-80) = P (111-96) XOR P (31-16). IP (79-64) = P (79-64) XOR P (47-32). IP (63-48) = P (15-0) XOR C (127-112). IP (47-32) = P (63-48) XOR C (111-96). IP (31-16) = P (31-16) XOR C (95-80). IP (15-0) = P (47-32) XOR C (79-64).The output <strong>of</strong> decryption block is obtained byXORing decrypted text with cipher text as shown. OP (63-0) = D (63-0) XOR C (127-64). OP (127-64) = D (127-64) XOR OP (63-0).The plaintext is then obtained as shown so as to get128 bits <strong>of</strong> plaintext.Figure 4: Block diagram <strong>of</strong> proposed key expansion system.B. EXTENSION TO 128 BITSWhenever the length <strong>of</strong> the plaintext exceeds 64 bits,different modes <strong>of</strong> operation are used to encrypt theentire plaintext using a single key. The prominentblock cipher modes <strong>of</strong> operation are electronic codebook (ECB), cipher block chaining (CBC), cipherfeedback (CFB), output feedback (OFB) and counter(CTR). P (127-112) = OP (127-112). P (111-96) = OP (95-80). P (95-80) = OP (111-96). P (79-64) = OP (79-64). P (63-48) = OP (47-32). P (47-32) = OP (15-0). P (31-16) = OP (31-16). P (15-0) = OP (63-48).The simplest mode among these is the ECB mode butit has the disadvantage that identical plaintext blocksare encrypted into identical cipher text blocks. Thus itdoes not hide the data pattern well. The other blockmode commonly used is the CBC mode which uses afeedback mechanism and an initialization vector (IV)in the beginning. The problem associated with the IVis that it needs to be random enough and must neverbe reused under the same key. For CBC and CFB,reusing an IV leaks some information about the firstblock <strong>of</strong> plaintext, and about any common prefixshared by the two messages. For OFB and CTR,reusing an IV completely destroys security [6]. Thiscan be seen because both modes effectively create bitsthat are XORed with the plaintext, and these bits aredependent on the password and IV only. Reusing thebits destroys security. If an attacker knows the IVbefore he specifies the next plaintext, he can check hisguess about the plaintext <strong>of</strong> some block that wasencrypted with the same key before.The below scheme demonstrates the use <strong>of</strong> CBC modewithout the need <strong>of</strong> IV. The input to the firstencryption block is obtained by performing XORoperations on the 128 bit plaintext. Let the input to theencryption block be IP, output <strong>of</strong> decryption block beOP, plaintext be P, cipher text be C and decrypted textbe D. The following operations are done as mentionedbelow. IP (127-112) = P (127-112) XOR P (15-0). IP (111-96) = P (95-80) XOR P (63-48).Figure 5: Block diagram <strong>of</strong> proposed extension to 128 bits.C. F-FUNCTIONBlowfish uses 4 8x32 S-boxes. The total memoryconsumed for storing the 4 S-boxes are 4096 bytesInternational Conference on Electronics and Communication Engineering, 28 th April-2013, Bengaluru, ISBN: 978-93-83060-04-746


and in addition 512 iterations <strong>of</strong> encryption is requiredto store the values <strong>of</strong> S-box. An alternative way toreduce the memory and computational time taken bythese S-boxes would be to use the substitution bytesand mix columns concept <strong>of</strong> AES. The S-box in AESis designed such that the correlation between the inputand output bits is very low and the mix column helpsin mixing the output bytes <strong>of</strong> the S-box. Since<strong>blowfish</strong> requires 4 S-boxes, the AES s-box is rotatedin cyclical manner to avoid any symmetric patternsbetween the output bytes <strong>of</strong> S-box.FPGA Implementation <strong>of</strong> Modified Blowfish Algorithm<strong>of</strong> dedicated hardware . Since the processing paths canbe executed in parallel speed can be very fast usingthe Field Programmable Gate Arrays.IV. SIMULATION RESULTS AND RTLSCHEMATICThe proposed <strong>algorithm</strong> is simulated and thesimulation results are as shown in the figure 7.Figure 7: Simulation results for proposed <strong>algorithm</strong>The RTL schematic <strong>of</strong> the proposed <strong>algorithm</strong> is asshown by the figure 8.Figure 8: RTL schematic <strong>of</strong> the proposed <strong>algorithm</strong>Figure 6: Block diagram <strong>of</strong> proposed F-function.This paper proposes the FPGA <strong>implementation</strong> <strong>of</strong> the<strong>modified</strong> <strong>blowfish</strong> <strong>algorithm</strong> using a high leveldescription language VHDL. This provides a lowpower <strong>implementation</strong> <strong>of</strong> the <strong>modified</strong> <strong>blowfish</strong><strong>algorithm</strong>. For processing the logic FPGAs make useREFERENCES[1] Tingyuan Nie, and Teng Zhang, “A Study <strong>of</strong> DES andBlowfish Encryption) Algorithm,” 978-1-4244-4547-9/09/IEEE, TENCON 2009.[2] Brian Cody, Justin Madigan,Spencer MacDonald, KennethW. Hsu,”High Speed SOC Design for BlowfishCryptographic Algorithm,” 2007 IFIP InternationalInternational Conference on Electronics and Communication Engineering, 28 th April-2013, Bengaluru, ISBN: 978-93-83060-04-747


Conference on Very Large Scale Integration (VLSI-SoC2007), 978-1-4244-1710-0/07.[3] Jawahar Thakur, Nagesh Kumar, “DES, AES and Blowfish:Symmetric Key Cryptography Algorithms Simulation BasedPerformance Analysis,” International Journal <strong>of</strong> EmergingTechnology and Advanced Engineering ISSN 2250-2459,Volume 1, Issue 2, December 2011.[4] H. Singpiel, H. Simmler, A. Kugel, R. Manner,A. C.CastaAon Vieia.F, Galvez-Durand, J. M. S . de Alciintara,V. C. Alves, “Implementation <strong>of</strong> CryptographicFPGA Implementation <strong>of</strong> Modified Blowfish AlgorithmApplications on the Reconfigurable FPGA CoprocessormicroEnable,” 0-7695-0843-X/00, 2000 IEEE.[5] Irfan.Landge, Burhanuddin Contractor, Aamna Patel andRozina Choudhary,” Image encryption and decryption using<strong>blowfish</strong> <strong>algorithm</strong>,” World Journal <strong>of</strong> Science andTechnology 2012, 2(3):151-156, ISSN: 2231 – 2587.[6] William Stallings ,”Cryptography and Network Security”,5 thedition ,Pearson Publications.[7] B. Schneier. The Blowfish Encryption Algorithm.http://www.schneier.com/<strong>blowfish</strong>.htmlInternational Conference on Electronics and Communication Engineering, 28 th April-2013, Bengaluru, ISBN: 978-93-83060-04-748

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!