You are on page 1of 4

Network Security, BS Computer Science C_ 2010 Department Of Computer Science .

(Group 4)

AES Advance Encryption Standard The block cipher


Karachi, Pakistan Department Of Computer Science Morning Program 2010 University Of Karachi , info@uok.edu.pk
http://www.uok.edu.pk 99261300 (Ext.:2219)

Abstract. is the practice and study of hiding information. Modern cryptography intersects the disciplines of mathematics, computer science, and engineering. Applications of cryptography include ATM cards, computer passwords, and electronic commerce. Cryptology prior to the modern age was almost synonymous with encryption, the conversion of information from a readable state to nonsense. The sender retained the ability to decrypt the information and therefore avoid unwanted persons being able to read it. Symmetric-key cryptography refers to encryption methods in which both the sender and receiver share the same key (or, less commonly, in which their keys are different, but related in an easily computable way). This was the only kind of encryption publicly known until June 1976. In cryptography, the Advanced Encryption Standard (AES) is a symmetric-key encryption standard adopted by the U.S. government. The standard comprises three block ciphers, AES-128, AES-192 and AES256, adopted from a larger collection originally published as Rijndael. Each of these ciphers has a 128-bit block size, with key sizes of 128, 192 and 256 bits, respectively. The AES ciphers have been analyzed extensively and are now used worldwide, as was the case with its

predecessor, the Data Encryption Standard (DES). Key Words. To understand explanation of the implementation of the AES (RIJNDAEL) encryption algorithm. The purpose of this paper is to give developers with little or no knowledge of cryptography the ability to implement AES. 1 Introduction

AES is an iterated symmetric block cipher, which means that: AES works by repeating the same defined steps multiple times. AES is a secret key encryption algorithm. AES operates on a fixed number of bytes AES as well as most encryption algorithms is reversible. This means that almost the same steps are performed to complete both encryption and decryption in reverse order. The AES algorithm operates on bytes, which makes it simpler to implement and explain. This key is expanded into individual sub keys, a sub keys for each operation round. This process is called KEY EXPANSION, which is described at the end of this document. As mentioned before AES is an iterated block cipher. All that means is that the same operations are performed many times 1

on a fixed number of bytes. These operations can easily be broken down to the following functions: ADD ROUND KEY BYTE SUB SHIFT ROW MIX COLUMN An iteration of the above steps is called a round. The amount of rounds of the algorithm depends on the key size.
Key Size (bytes) 16 24 32 Block Size (bytes) 16 16 16 Rounds 10 12 14

3: Mix Column(Add Round Key(Byte Sub(Shift Row(State)))) . . . 9: Add Round Key(Byte Sub(Shift Row(State))) Also for Round 12 and 14

The only exception being that in the last round the Mix Column step is not performed, to make the algorithm reversible during decryption.
Encryption Part: Start From Round 0: Add Round Key(Mix Column(Shift Row(Byte Sub(State)))) 1: Add Round Key(Mix Column(Shift Row(Byte Sub(State)))) 2: Add Round Key(Mix Column(Shift Row(Byte Sub(State)))) 3: Add Round Key(Mix Column(Shift Row(Byte Sub(State)))) . . . 9:Add Round Key(Shift Row(Byte Sub(State))) Also for Round 12 and 14 Decryption Part: Start From Rounds 0: Mix Column(Add Round Key(Byte Sub(Shift Row(State)))) 1: Mix Column(Add Round Key(Byte Sub(Shift Row(State)))) 2: Mix Column(Add Round Key(Byte Sub(Shift Row(State))))

Add Round Key Each of the 16 bytes of the state is XORed against each of the 16 bytes of a portion of the expanded key for the current round. The Expanded Key bytes are never reused. So once the first 16 bytes are XORed against the first 16 bytes of the expanded key then the expanded key bytes 1-16 are never used again. The next time the Add Round Key function is called bytes 17-32 are XORed against the state. The first time Add Round Key gets executed Byte Sub During encryption each value of the state is replaced with the corresponding SBOX value AES S-Box Lookup Table For example HEX 19 would get replaced with HEX D4 During decryption each value in the state is replaced with the corresponding inverse of the SBOX For example HEX D4 would get replaced with HEX 19 Shift Row Arranges the state in a matrix and then performs a circular shift for each row. This is not a bit wise shift. The circular shift just moves each byte one space over. A byte that was in the second position may end up in the third position after the shift. The circular part of it specifies that the byte in the last position shifted one space will end up in the first position in the same row. In Detail: 2

The state is arranged in a 4x4 matrix (square) The confusing part is that the matrix is formed vertically but shifted horizontally. So the first 4 bytes of the state will form the first bytes in each row. Field Addition and Multiplication in GF(28) As you've seen, the AES encryption algorithm uses fairly straightforward techniques for substitution and permutation, except for the MixColumns routine. The MixColumns routine uses special addition and multiplication. The addition and multiplication used by AES are based on mathematical field theory. In particular, AES is based on a field called GF(28). The GF(28) field consists of a set of 256 values from 0x00 to 0xff, plus addition and multiplication, hence the (28). GF stands for Galois Field, named after the mathematician who founded field theory. One of the characteristics of GF(28) is that the result of an addition or multiplication operation must be in the set {0x00 ... 0xff}. Although the theory of fields is rather deep, the net result for GF(28) addition is simple: GF(28) addition is just the XOR operation. Multiplication in GF(28) is trickier, however. As you'll see later in the C# implementation, the AES encryption and decryption routines need to know how to multiply by only the seven constants 0x01, 0x02, 0x03, 0x09, 0x0b, 0x0d, and 0x0e. So instead of explaining GF(28) multiplication theory in general, I will explain it just for these seven specific cases. Multiplication by 0x01 in GF(28) is special; it corresponds to multiplication by 1 in normal arithmetic and works the same wayany value times 0x01 equals itself. Now let's look at multiplication by 0x02. As in the case of addition, the theory is deep, but the net result is fairly simple. If the value being multiplied is less than 0x80, then the result of multiplication is just the value leftshifted 1 bit position. If the value being multiplied is greater than or equal to 0x80, then the result of multiplication is the value

left-shifted 1 bit position XORed with the value 0x1b. This prevents "field overflow" and keeps the product of the multiplication in range. Once you've established addition and multiplication by 0x02 in GF(28), you can use them to define multiplication by any constant. To multiply by 0x03 in GF(28), you can decompose 0x03 as powers of 2 and additions. To multiply an arbitrary byte b by 0x03, observe that 0x03 = 0x02 + 0x01. Thus: b * 0x03 = b * (0x02 + 0x01) = (b * 0x02) + (b * 0x01) This can be done because you know how to multiply by 0x02 and 0x01 and how to perform addition. Similarly, to multiply an arbitrary byte b by 0x0d, you do this: b * 0x0d = b * (0x08 + 0x04 + 0x01) = (b * 0x08) + (b * 0x04) + (b * 0x01) = (b * 0x02 * 0x02 * 0x02) + (b * 0x02 * 0x02) + (b * 0x01) AES Key Expansion Prior to encryption or decryption the key must be expanded. The expanded key is used in the Add Round Key function defined above. Each time the Add Round Key function is called a different part of the expanded key is XORed against the state. In order for this to work the Expanded Key must be large enough so that it can provide key material for every time the Add Round Key function is executed. The Add Round Key function gets called for each round as well as one extra time at the beginning of the algorithm. There fore the size of the expanded key will always be equal to: 16 * (number of rounds + 1). The 16 in the above function is actually the size of the block in bytes. This provides key material for every byte in the block during every round +1 Since the key size is much smaller than the size of the sub keys, the key is actually stretched out to provide enough key space for the algorithm. 3

The key expansion routine executes a maximum of 4 consecutive functions. These functions are:

ROT WORD SUB WORD RCON EK K

2 Conclusion. The above document provides you with only the basic information needed to implement the AES encryption algorithm. The mathematics and design reasons behind AES were purposely left out. For more information on these topics I suggest you visit the Rijndael Home Page at:
http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ This paper is written by Group 4 Students BSCS IV year 8 Semester.
th

Referrences.

http://msdn.microsoft.com/en-us/magazine/cc164055.aspx http://en.wikipedia.org/wiki/Advanced_Encryption_Standard http://en.wikipedia.org/wiki/Cryptography http://hubpages.com/hub/cryptography-and-network-security

You might also like