Implementation of Advanced Encryption Standard Algorithm
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Scientific & Engineering Research Volume 3, Issue 3, March -2012 1 ISSN 2229-5518 Implementation of Advanced Encryption Standard Algorithm M.Pitchaiah, Philemon Daniel, Praveen Abstract—Cryptography is the study of mathematical techniques related to aspects of information security such as confidentiality, data integrity, entity authentication and data origin authentication. In data and telecommunications, cryptography is necessary when communicating over any unreliable medium, which includes any network particularly the internet. In this paper, a 128 bit AES encryption and Decryption by using Rijndael algorithm (Advanced Encryption Standard algorithm) is been made into a synthesizable using Verilog code which can be easily implemented on to FPGA. The algorithm is composed of three main parts: cipher, inverse cipher and Key Expansion. Cipher converts data to an unintelligible form called plaintext. Key Expansion generates a Key schedule that is used in cipher and inverse cipher procedure. Cipher and inverse cipher are composed of special number of rounds. For the AES algorithm, the number of rounds to be performed during the execution of the algorithm uses a round function that is composed of four different byte-oriented transformations: Sub Bytes, Shift Rows, Mix columns and Add Round Key. Index Terms—Advanced Encryption Standard, Cryptography, Decryption, Encryption. I. INTRODUCTION standard explicitly defines the allowed values for the key T HE Cryptography plays an important role in the security of length (Nk), block size (Nb), and number of rounds (Nr). data transmission [1]. This paper addresses efficient hardware B. AES Algorithm Specification implementation of the AES (Advanced Encryption Standard) algorithm and describes the design and performance testing of For the AES algorithm, the length of the input block, the Rijndael algorithm [3]. A strong focus is placed on high output block and the State is 128 bits. This is represented by throughput implementations, which are required to support Nb = 4, which reflects the number of 32-bit words (number of security for current and future high bandwidth applications columns) in the State. [5][6][7][8][9]. This implementation will be useful in wireless security like military communication and mobile telephony where there is a gayer emphasis on the speed of communication [5]. This standard specifies the Rijndael algorithm, a symmetric block cipher that can process data blocks of 128 bits, using cipher keys with lengths of 128,192, and 256 bits [2]. Throughout the remainder of this standard, the algorithm specified herein will be referred to as ―the AES algorithm.‖ The algorithm may be used with the three different key lengths indicated above, and therefore these different ―flavors‖ may be referred to as ―AES-128‖, ―AES- 192‖, and ―AES-256‖. A. AES Algorithm AES is short for Advanced Encryption Standard and is a United States encryption standard defined in Federal Information Processing Standard (FIPS) 192. AES is the most Fig 1: General structure of AES algorithm recent of the four current algorithms approved for federal us in the United States. AES is a symmetric encryption algorithm An implementation of the AES algorithm shall support at least processing data in block of 128 bits. AES is one of the three key lengths: 128, 192, or 256 bits (i.e., Nk = 4, 6, symmetric since the same key is used for encryption and the or 8, respectively). Implementations may optionally support reverse transformation, decryption [2]. The only secret two or three key lengths, which may promote the necessary to keep for security is the key. AES may configured interoperability of algorithm implementations. For the AES to use different key-lengths, the standard defines 3 lengths algorithm, the length of the Cipher Key, K, is 128, 192 or 256 and the resulting algorithms are named AES-128, AES-192 bits. The key length is represented by Nk = 4, 6, or 8which and AES-256 respectively to indicate the length in bits of the reflects the number of 32-bit words (number of columns) in key. The older standard, DES or Data Encryption Standard. the Cipher Key. For the AES algorithm, the number of rounds DES is upto 56bits only [4]. To overcome the disadvantages of to be performed during the execution of the algorithm is des algorithm, the new standard is AES algorithm. This dependent on the key size. The number of rounds is represented by Nr, where Nr = 10 when Nk = 4, Nr = 12 when IJSER © 2012 http://www.ijser.org International Journal of Scientific & Engineering Research Volume 3, Issue 3, March -2012 2 ISSN 2229-5518 Nk = 6, and Nr = 14 when Nk = 8. The only Key-Block-Round Mix Columns—a mixing operation which operates on combinations that conform to this standard are given in Table the columns of the state, combining the four bytes in 1. each column Bit Key Length Block Size No Of Add Round Key—each byte of the state is combined pattern (NK Words) (NB Words) Rounds with the round key; each round key is derived from (NR Words) the cipher key using a key schedule AES- 4 4 10 B. Sub bytes Transformation 128 AES- 6 4 12 The Sub Bytes transformation is a non-linear byte substitution 192 that operates independently on each byte of the State using a AES- 8 4 14 substitution table (S-box). This S-box which is invertible is 256 constructed by composing two transformations: 1. Take the multiplicative inverse in the finite field GF (28), the Table 1. Key-Block-Round Combinations. element {00} is mapped to itself. 2. Apply the following affine transformation (over GF (2)): For both its Cipher and Inverse Cipher, the AES algorithm For 0<i<8, where bi is the ith bit of the byte, and ci is the ith bit uses a round function that is composed of four different byte- of a byte c with the oriented transformations: Value {63} or {01100011}. Here and elsewhere, a prime on a 1) Byte substitution using a substitution table (S-box), variable (e.g., b) 2) Shifting rows of the State array by different offsets, Indicates that the variable is to be updated with the value on 3) Mixing the data within each column of the State array, and the right. In matrix form, the affine transformation element of 4) Adding a Round Key to the State. the S-box can be expressed as: II. ENCRYPTION In encryption mode, the initial key is added to the input value at the very beginning, which is called an initial round. This is followed by 9 iterations of a normal round and ends with a slightly modified final round, as one can see in Figure 2. During one normal round the following operations are performed in the following order: Sub Bytes, Shift Rows, Mix Columns, and Add Round key. The final round is a normal round without the Mix Columns stage. Fig 3: Affine transformation 63 7C 77 7B CA 82 C9 7D B7 FD 93 26 04 C7 23 C3 Fig 4: S-BOX Fig 2: General structure of Encryption. A. Steps in AES Encryption Sub Bytes—a non-linear substitution step where each Fig.5 Effect of the Sub Bytes () transformation on the State. byte is replaced with another according to a lookup table. Shift Rows—a transposition step where each row of C. Shift Rows Transformation the state is shifted cyclically a certain number of steps. In the Shift Rows transformation, the bytes in the last three rows of the State are cyclically shifted over different numbers IJSER © 2012 http://www.ijser.org International Journal of Scientific & Engineering Research Volume 3, Issue 3, March -2012 3 ISSN 2229-5518 of bytes (offsets). The first row is not shifted at all, the second row is shifted by one the third row by two, and the fourth row by three bytes to the left. Specifically, the Shift Rows transformation proceeds as follows: E. Add round Key Transformation The shift value shift(r,Nb) depends on the row number, r, as In the Add Round Key transformation, a Round Key is added to follows (recall that Nb = 4): shift(1,4) 1; shift(2,4) 2 ; shift(3,4) 3 the .This has the effect of moving bytes to ―lower‖ positions in the State by a simple bitwise XOR operation. Each Round Key row (i.e., lower values of c in a given row), while the ―lowest‖ consists bytes wrap around into the ―top‖ of the row (i.e., higher of Nb words from the key schedule.Those Nb words are each values of c in a given row) added into the columns of the State, such that [wi] are the key schedule words, and round is a value in the range 0 round Nr. In the Cipher, the initial Round Key addition occurs when round = 0, prior to the first application of the round function. The application of the Add Round Key transformation to the Nr rounds of the Cipher occurs Fig.6 .Shift Rows cyclically shifts the last three rows in the when 1<round <Nr. The action of this transformation is State. illustrated in Fig. 8, where l = round * Nb. D. MixColumns Transformation The Mix Columns transformation operates on the State column-by-column, treating each column as a four-term polynomial. ' s0,c 02 03 01 01 s0,c ' s 01 02 03 01 s 1,c 1,c ' s2,c 01 01 02 03 s2,c ' s s3,c 03 01 01 02 3,c Fig.8. AddRoundKey XORs each column of the State with a word from the key schedule. (0 c < Nb) As a result of this multiplication, the four bytes in a column F.