VHDL Implementation of Twofish Algorithm - Precog

44 downloads 68 Views 328KB Size Report
VHDL Implementation of Twofish Algorithm. Purnima Gehlot. Richa Sharma. S. R. Biradar. Mody Institute of. Mody Institute of. Mody Institute of. Technology.
VHDL Implementation of Twofish Algorithm Purnima Gehlot

Richa Sharma

S. R. Biradar

Mody Institute of Technology and Science Laxmangarh, Sikar Rajasthan,India

Mody Institute of Technology and Science Laxmangarh, Sikar Rajasthan,India

Mody Institute of Technology and Science Laxmangarh, Sikar Rajasthan,India

[email protected] [email protected] ABSTRACT Every day hundreds and thousands of people interact electronically, whether it is through emails, e-commerce, etc. through internet. For sending sensitive messages over the internet, we need security. In this paper a security algorithms, Twofish (Symmetric key cryptographic algorithm) [1] has been explained. All the important modules of Twofish algorithm, which are Function F and g, MDS, PHT, are implemented on Xilinx – 6.1 xst software and there delay calculations has been done on FPGA families which are Spartan2, Spartan2E and VirtexE.

[email protected]

which consists of two modules of function g, one MDS i.e. maximum distance separable matrix,a PHT i.e. pseudo hadamard transform and two adders of 32-bit for one round. To increase the complexity of the algorithm we can perform Endian function over the input bit stream. Different modules of twofish algorithms are:

2.1 ENDIAN FUNCTION Endian Function is a transformation of the input data. It is used as an interface between the input data provided to the circuit and the rest of the cipher. It can be used with all the key-sizes [5]. Here 128-bit input is divided into 16 bytes from byte0 to byte15 and are rearranged to get the output of 128-bit.

Keywords Twofish, MDS, PHT, symmetric key, Function F and g.

1. INTRODUCTION Twofish is a 128-bit block cipher and variable-length key up to 256 bits are acceptable in it. There is a 16-round Feistel network with a function F made up of four key-dependent 8-by-8-bit S-boxes [3], a fixed 4-by-4 maximum distance separable (MDS) matrix over GF(28), a pseudo-Hadamard transform (PHT), bitwise rotations, and a carefully designed key schedule. It is a symmetric key algorithm which is also called as private key algorithm because only one key used for both the encryption and decryption purpose. Objective of the dissertation is to perform an efficient method of implementing a twofish algorithm with minimum delay and having high performance in terms of delay while maintaining the proper functionality of the system. The software used for the implementation of the algorithm is Xilinx 6.1 – xst and language used is VHDL (very high speed integrated circuit hardware description language). Simulation of encryption process of the twofish algorithm has been done using the Xilinx software. Inputs will be converted into binary form and given as input to the "Model-Sim Simulator" of Xilinx 6.1 xst. Structure of Twofish algorithm is shown in Figure 1.

The organisation of paper is like this, First of all the description of all the modules of algorithms with appropriate diagram has been given, then the results of delay has been shown.

2. DIFFERENT MODULES OF TWOFISH ALGORITHM Mainly there are three main steps in this algorithm, input whitening, sixteen iterations of round function and output whitening. Input is combined mathematically with the keys (key is divided into bytes and XORed with the input bytes). This process was input whitening. After 16 rounds same process happens in output whitening. During the rounds, function F is the main module for it,

Figure 1: T w o f i s h S t r u c t u r e

2.2 PHT TRANSFORM)

(PSUEDO

HADAMARD

PHT is a reversible transformation of a bit string that provides cryptographic diffusion. SAFER was the first cipher block which uses 8-bit PHTs extensively for diffusion [6]. Twofish uses a 32-bit PHT. The outputs from the two g functions are given as input to the PHT module, it performs some addition operations over it and produces output. It is a two input, two output function. Given two inputs, a and b, the 32-bit PHT is: a’ = a + b mod 232

b ’= a + 2b mod 232

2.3 MDS SEPARABLE)

(MAXIMUM

DISTANCE

A 4-by-4 MDS matrix is used in twofish algorithm. MDS matrices are useful building blocks for ciphers because they guarantee a certain degree of diffusion. There are only three coefficients in MDS matrix, 01, EF and 5B [4]. The result of a multiplication can be reduced to a series of XOR’s for each bit of the output.

T0= g (R0)

T1 = g (ROL (R1, 8))

F0 = (T0 + T1 + K2r+8) mod 32

F1= (T0 + 2T1 + K2r+9) mod 32

2.6 ENCRYPTION Encryption is the process of converting the data from plain-text to cipher [2]. Here in this paper encryption of 128bit input is considered for one round. The ouput of encryption will be given for output whitening and we will get the ciphertext as output.

3. RESULTS The delay table have been generated as result is shown in Table 1. The interface and RTL for Encryption is shown in Figure 2.

Z = [MDS] [Y] TABLE 1. DELAY AND FREQUENCY OF DIFFERENT MODULES

Parameters

Delay (ns)

Frequency (MHz)

Endian

6.479

154.34

Function F

104.102

9.60

Function g

39.383

25.39

MDS

15.520

62.81

PHT

61.172

16.34

Encryption

105.794

9.40

Figure 2: RTL for Encryption

6.

REFERENCES

[1] Dr. S.A.M Rizvi, Dr. Syed Zeeshan Hussain, Neeta Wadhwa,

“Performance Analysis of AES and TwoFish Encryption Schemes” in International Conference on Communication Systems and Network Technologies of IEEE Computer Society, 2011, pg. 76-79, vol-3

The MDS matrix is given as:

[2] Bruce Schneier, John Kelsey, Doug Whitingz David Wagnerx

Chris Hall, Niels Ferguson “Twofish: A 128-Bit Block Cipher” AES submission, 1998.

2.4 FUNCTION g It consists of two main elements, the key-dependent S-boxes and the MDS matrix. Input is splitted into 4-byte, processed and merged back into a 32-bit stream. Output from S-boxes are given to the MDS matrix, where it is multiplied with the fix matrix and we get the output.

2.5 FUNCTION F Function F is the main operation of the algorithm. It consists of four key-dependent 8-by-8-bit S-boxes, a fixed 4-by-4 maximum distance separable matrix, a pseudo-Hadamard transform, bitwise rotations and a key schedule. The operations of this function can be explained easily by:

[3] Shun-Lung Su, Lih-Chyau Wuu, and Jhih-Wei Jhang, “A New

256-bits Block Cipher –Twofish 256”, Computer Engineering & Systems, International Conference in IEEE, 2010, pg 166 - 171 [4] Mark De Clercq, Vincent Levesque “A VHDL Implementation

of the Twofish Block Cipher” in IEEE, 2006 [5] Hani H. JABER “Relational Database Security Enhancements”,

in Arab University, 2008 [6]

Uskov, A.V, “Information Security of IPsec-based Mobile VPN: Authentication and Encryption Algorithms Performance” Trust Security and Privacy in Computing and Communication, 11th International National Conference in IEEE, 2012, pg. 1042-1046

Suggest Documents