VIEWS: 52 PAGES: 7 CATEGORY: Templates POSTED ON: 4/29/2012 Public Domain
International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 Performance Analysis of RC5 and RC6 Block Cipher Algorithms Ravindra Kumar Singh Harsh Kumar Verma Department of Computer Science & Engineering Department of Computer Science & Engineering NIT Jalandhar, Punjab (India) NIT Jalandhar, Punjab (India) ravindra1987singh@gmail.com vermah@nitj.ac.in Abstract - In this paper, Performance analysis of RC5 and RC5 is a block cipher notable for its simplicity. Designed RC6 block cipher algorithms have been done on the basis of by Ronald Rivest in1994, RC stands for "Rivest Cipher", execution time and resource utilization. CPU utilization and or alternatively, "Ron's Code". It is suitable for hardware memory utilization both are considered for determining and software implementation, because it uses only those resource utilization. Both of these algorithms are fast symmetric encryption algorithms and make heavy use of operations which are available in typical microprocessor data dependent rotations and mixture of different [6]. operations, which provide the security. In particular, the use RC6 is derived from RC5 [7]. There are two main new of data-dependent rotations helps defeat differential and features in RC6 compared to RC5: the inclusion of integer linear cryptanalysis. RC5 uses two w-bit registers for carrying out the operation in encryption procedure while multiplication and the use of four w-bit working registers RC6 uses four w-bit registers. Allowable choices for w are 16 instead of two w-bit registers as in RC5. It was designed bits, 32 bits, and 64 bits. Both are parameterized algorithms by Ron Rivest, Matt Robshaw, Ray Sidney and Yiqun with a variable block size, a variable key size, and a variable Lisa Yin to meet the requirements of the Advanced number of rounds. Performances of these two algorithms Encryption Standard (AES) [8] competition. The have been evaluated on key size of 128-bits, 192-bit and 256- algorithm was one of the five finalists and was also bit in this paper. submitted to the NESSIE [9] and CRYPTREC [10] projects. It is a proprietary algorithm, patented by RSA Keywords - Cryptography, Block cipher, Symmetric Security. encryption, RC5, RC6. II. RC5 BLOCK CIPHER I. INTRODUCTION The RC5 encryption algorithm is a block cipher that In cryptography [1], the use of the symmetric key converts plain text data blocks of 16, 32, and 64 bits into encryption is common to ensure data confidentiality, it cipher text blocks of the same length. It uses a key of uses same key for both encryption of plain text and selectable length b (0, 1, 2, ..., 255) byte. The algorithm is decryption of cipher text. Symmetric encryption is organized as a set of iterations called rounds r that takes illustrated in fig 1. values in the range (0, 1, 2, ..., 255) as illustrated in fig. 2. Fig 1: Symmetric Encryption Symmetric key encryption code can be divided into the block cipher and stream one [1]. RC5 [2,3] and RC6 [4,5] is a symmetric key block cipher. Fig 2: RC5 Encryption Algorithm March Issue Page 8 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 The operations performed on the data blocks include Tables 1 [2] show these magic constants in hexadecimal bitwise exclusive-OR of words, data-dependent rotations using several values of w. Which are calculated by above by means of circular left and right rotations and Two's expressions (1) & (2). complement addition/subtraction of words, which is modulo-2w addition/subtraction. RC5 is a fully Table 1. Magic Constants values Pw and Qw parameterized family of encryption algorithms, it is more W 16 32 64 accurately specified as RC5-w/r/b where the word size is Pw B7E1 B7E15163 B7E151628AED2A6B w bits, encryption consists of a nonnegative number of Qw 9E37 9E3779B9 9E3779B97F4A7C15 rounds r and b denotes the length of the encryption key in bytes. The original suggested choice of parameters were Key-Expansion with RC5-w/r/b w = 32 bits, r = 12 and b = 16-byte. For all variants, RC5-w/r/b operates on units of two w-bit words using the Input: b byte key that is preloaded into c word array following basic operations. L[0,1,…, c-1], r denotes the no of rounds. Output: 2r+2 w-bit round keys S[0, 1, …, 2r, 2r+1]. The operations used in RC6 are defined as followings. Procedure: A+B integer addition modulo 2w S[0] = Pw, A-B integer subtraction modulo 2w For i= 1 to 2r+1 do A⊕B bitwise exclusive-or of w-bit words { A<<<B rotation of the w-bit word A to the left S[i] = S[i – 1] + Qw by the amount given by the least significant lg w } bits of B X=Y=a=b=0 A>>>B rotation of the w-bit word A to the right Iteration =3 * max(c, 2r+2) by the amount given by the least significant lg w For i = 1 to Iteration do bits of B { There are three routines in RC5: key expansion, X = S[a] = (S[a] + X + Y) <<< 3 encryption, and decryption [11]. We discus each of them Y =L[b] = (L[b] +X + Y) <<< (X + Y) in next sections, Key-Expansion algorithm is used to i = (a + 1) mod (2r + 2) generate the round sub keys that will be use in both j = (b + 1) mod c encryption and decryption algorithms. RC5 has different } algorithms for encryption and decryption, in encryption it uses integer addition modulo 2w but in decryption it uses B. Encryption Algorithm integer subtraction modulo 2w. RC5 is a symmetric key Fig 3 illustrates the encryption procedure of RC5; encryption so encryption and decryption algorithms uses decryption procedure is just reverse of this structure by same key. converting addition operation to subtraction operations. A. Key-Expansion Algorithm The user supplies a key of b bytes, copy the secret key K[0...b-1] into an array L[0..c-1] of c = ceil(b/u), where u = w/8 in little-endian order. In other words, we fill up L using u consecutive key bytes of K. Any unfilled byte positions in L are zeroed. In the case that b = c = 0, set c = 1 and L[0] = 0. The number of w-bit words that will be generated for additive round keys is 2(r + 1) and these are stored in the array S[0, ..., 2r + 1]. Magic Constants Pw and Qw are defined for arbitrary w as follows: Pw = Odd ((e -1) 2w) (1) Qw = Odd ((v - 1) 2w) (2) Where e is the base of natural logarithms (e = 2.718281828459) and Fig 3: RC5 Block Cipher v is the golden ratio (v =1.618033988749) Odd (x) is the odd integer nearest to x [2]. RC5 works with two w-bit registers A and B which contain the initial input plain text as well as the output cipher text at the end of encryption. The first byte of plain March Issue Page 9 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 text or cipher text is placed in the least-significant byte of not present in RC5 in order to make the rotation A, the last byte of plain text or cipher text is placed into dependent on every bit in a word and not just the least the most-significant byte of B. Pseudo code of encryption significant few bits. Integer multiplication is used to is given below; at first we load plain text in to registers A increase the diffusion achieved per round so that fewer and B then apply these operations to encrypt the plain text rounds are needed and the speed of the cipher can be [2]. increased. The base-two logarithm of w will be denoted by lg w. Encryption with RC5-w/r/b Like RC5, RC6 is a fully parameterized family of Input: Plain text stored in two w-bit input registers A encryption algorithms. A version of RC6 is more and B. r denotes the no of rounds and 2r+2 w-bit round accurately specified as RC6-w/r/b where the word size is keys S[0, 1, ..., 2r + 1] w bits, encryption consists of a nonnegative number of rounds r and b denotes the length of the encryption key in Output: Cipher text will be store in A and B. bytes. Since the AES submission is targeted at w = 32 and Procedure: r = 20, we shall use RC6 as shorthand to refer to such A = A + S[0] versions. When any other value of w or r is intended in B = B + S[1] the text, the parameter values will be specified as RC6- for i = 1 to r do w/r. Of particular relevance to the AES effort will be the { versions of RC6 with 16-, 24- and 32-byte keys. For all A = ((A ⊕ B) <<< B) + S[2i] variants, RC6-w/r/b operates on units of four w-bit words B = ((B ⊕ A) <<< A) + S[2i+ 1] using the following basic operations [12]. } The operations used in RC6 are defined as followings. After applying these operations on registers A and B plain A+B integer addition modulo 2w text get converted into the cipher text and we store it in A-B integer subtraction modulo 2w any file that is called encrypted file. A⊕B bitwise exclusive-or of w-bit words C. Decryption Algorithm A*B integer multiplication modulo 2w Pseudo code of decryption is given below; for decryption A<<<B rotation of the w-bit word A to the left of cipher text load cipher text into registers A and B then by the amount given by the least significant lg w apply these operations to convert cipher text into plain bits of B text. A>>>B rotation of the w-bit word A to the right by the amount given by the least significant lg w Decryption with RC5-w/r/b bits of B Input: Cipher text stored in two w-bit input registers A f(x) = x(2x+1)mod 2w and B. r denotes the no of rounds and 2r+2 w-bit round keys S[0, 1, ..., 2r + 1] There are three routines in RC5: key expansion, encryption, and decryption. We discus each of them in Output: Plain text will be store in A and B. next sections, Key-Expansion algorithm is used to Procedure: generate the round sub keys that will be use in encryption for i = r down to 1 do and decryption algorithms. RC6 has different algorithms { for encryption and decryption, in encryption it uses B = ((B - S[2i + 1]) >>>A) ⊕ A integer addition modulo 2w but in decryption it uses A = ((A - S[2i]) >>> B) ⊕ B integer subtraction modulo 2w. RC6 is a symmetric key } encryption so encryption and decryption algorithms uses B = B - S[1] same key. A = A - S[0] A. Key-Expansion Algorithm w This algorithm uses integer subtraction modulo 2 and Key-Expansion Algorithm of RC6 is similar as RC5, only right rotation on registers for getting plain text; it does difference is that RC6 will be generate 2r+4 additive reverse operations on registers. round keys rather that 2(r + 1) used in RC5 [12]. III. RC6 BLOCK CIPHER Key-Expansion with RC6-w/r/b RC6 is very similar to RC5 in structure, using data- Input: b byte key that is preloaded into c word array dependent rotations [5], addition modulo 2w and L[0,1,…, c-1], r denotes the no of rounds. XOR operations; in fact, RC6 could be viewed as Output: 2r+4 w-bit round keys S[0,1, …, 2r + 2,2r+3]. interweaving two parallel RC5 encryption processes. Procedure: However, RC6 does use an extra multiplication operation S[0] = Pw, March Issue Page 10 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 For i= 1 to 2r+3 do D = D + S[1] { for i = 1 to r do S[i] = S[i – 1] + Qw { } t = (B * (2B + 1)) <<< lg w X=Y=a=b=0 u = (D * (2D + 1)) <<< lg w A = ((A ⊕ t) <<< u) + S[2i] Iteration =3 * max(c, 2r+4) C = ((C ⊕ u) <<< t) + S[2i+ 1] For i = 1 to Iteration do (A, B, C, D) = (B, C, D, A) { } X = S[a] = (S[a] + X + Y) <<< 3 A = A + S[2r + 2] Y =L[b] = (L[b] +X + Y) <<< (X + Y) C = C + S[2r + 3] i = (a + 1) mod (2r + 4) j = (b + 1) mod c Operation (A, B, C, D) = (B, C, D, A) means the parallel } assignment of values on the right to registers on the left. B. Encryption Algorithm After applying these operations on registers A, B, C, D plain text gets converted into the cipher text. Fig 4 illustrates the encryption procedure of RC6; decryption procedure is just reverse of this structure by C. Decryption Algorithm converting addition operation to subtraction operations. Pseudo code of decryption [12] is given below; for decryption of cipher text load these cipher text into registers A, B, C, D and then apply these operations to convert cipher text into plain text. Decryption with RC6-w/r/b Input: Cipher text stored in four w-bit input registers A, B, C, D. r denotes the no of rounds and 2r+4 w-bit round keys S[0, 1, ..., 2r + 3] Output: Plain text will be store in A, B, C, D Procedure: C = C - S[2r + 3] A = A - S[2r + 2] for i = r down to 1 do { (A, B, C, D) = (D, A, B, C) u = (D * (2D + 1)) <<< lg w Fig 4: RC6 Block Cipher t = (B * (2B + 1)) <<< lg w C = ((C - S[2i + 1]) >>> t) ⊕ u RC6 works with four w-bit registers A, B, C, D which A = ((A - S[2i]) >>> u) ⊕ t contain the initial input plain text as well as the output } cipher text at the end of encryption. The first byte of plain D = D - S[1] text or cipher text is placed in the least-significant byte of B = B - S[0] A, the last byte of plain text or cipher text is placed into the most-significant byte of D [2]. Pseudo code of This algorithm uses integer subtraction modulo 2w and encryption [12] is given below; at first we load plain text right rotation on registers for getting plain text; it does in to registers A, B, C, D and then apply these operations reverse operations on registers. to encrypt the plain text. IV. COMPARISON AND ANALYSIS Encryption with RC6-w/r/b A comparative analysis of RC5 & RC6 is performed to Input: Plain text stored in four w-bit input registers A, provide some measurements on the encryption and B, C, D. r denotes the no of rounds and 2r+4 w-bit round decryption. Effects of several parameters such as number keys S[0, 1, ..., 2r + 3] of rounds, block size and the length of secret key on the Output: Cipher text will be store in A, B, C, D performance evaluation criteria are investigated. These two encryption algorithms were implemented in c# Procedure: in visual studio 2009. Performance was measured on a B = B + S[0] March Issue Page 11 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 3GHz Pentium®4 with 1GB of RAM running Windows Table 5: Comparison on the basis of execution time for 32-bytes key XP professional Version 2002, Service pack 3. File Name File Size RC5 RC6 (file type) (in KB) A. Parametric Comparison A.doc 712 109.375 125 Table 2 summarizes the comparison of RC5 & RC6 for B.pdf 649 109.375 140.625 different design parameters such as word size, block size, C.jpg 656 93.75 109.375 number of rounds and secret key size. D.gif 1396 156.25 203.125 E.mp3 2068 234.375 296.875 Table 2: Comparison on the basis of parameters F.avi 2800 328.125 406.25 Parameters Algorithm Type Fig 5, 6 and 7 illustrate the execution time according to RC5 RC6 b (key length in bytes) 0 - 255 0 - 255 their file size for each files using algorithm RC5 & RC6 r (no of rounds) 0 – 255 0 – 255 for 16-bytes, 24-bytes and 32-bytes key respectively. (standard 12) (standard 20) Execution time of RC5 is represented by blue color and No of round keys 2r+2 2r+4 Block size in words 2w 4w RC6 is represented by red color. w (word size in bits) 16, 32, 64 16, 32, 64 (standard 32) (standard 32) Graph shows that RC5 performs faster than RC6 for every Block size in bits 32, 64, 128 64, 128, 256 key size. It can also be determined that RC5 performs (standard 64) (standard 128) faster on 24-byes of key size. Transformation Function Does not exist F(x) = x(2x+1) mod 2w 500 +, -, ⊕, <<<, >>> +, -, ⊕, *, <<<, Processing Time in ms Used Operation >>> 400 B. Performance Comparison 300 200 In addition, to improve the accuracy of our timing measurements, program was executed 10 times for each 100 input file and we report the average of the times thereby 0 obtained. In this observation key size have three values 712 649 656 1396 2068 2800 16-bytes, 24-bytes and 32-bytes while number of round(r) RC5 RC6 File Size in KB was fixed, 12 for RC5 and 20 for RC6. 1. Performance Comparison on the basis of Execution Fig 5: Execution time of RC5 & RC6 for 16-bytes key Time We compare the execution time of each algorithm on 500 Processing Time in ms different-2 file types like text file, audio file & video files, 400 for this purpose we mainly used 6 files and recorded their 300 execution (encryption or decryption) times in milliseconds for both algorithms. List of Input files and 200 their size are given in Table 3, 4 and 5. 100 0 Table 3: Comparison on the basis of execution time for 16-bytes key 712 649 656 1396 2068 2800 RC5 File Name File Size (in RC5 RC6 File Size in KB RC6 (file type) KB) A.doc 712 125 140.625 B.pdf 649 109.375 140.625 Fig 6: Execution time of RC5 & RC6 for 24-bytes key C.jpg 656 78.125 93.75 500 Processing Time in ms D.gif 1396 156.25 218.75 400 E.mp3 2068 234.375 281.25 F.avi 2800 312.5 421.875 300 200 Table 4: Comparison on the basis of execution time for 24-bytes key 100 File Name File Size (in RC5 RC6 0 (file type) KB) 712 649 656 1396 2068 2800 A.doc 712 109.375 125 RC5 B.pdf 649 93.75 125 RC6 File Size in KB C.jpg 656 93.75 109.375 D.gif 1396 156.25 218.75 E.mp3 2068 234.375 296.875 Fig 7: Execution time of RC5 & RC6 for 32-bytes key F.avi 2800 312.5 406.25 March Issue Page 12 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 2. Performance Comparison on the basis of CPU RC6 for 32-bytes key. Result also conclude that RC5 Utilization and Memory Utilization performs fastest for 24-bytes key while 24-bytes and 32- bytes key have same impact on RC6. In this section a video file (.avi) of 2800KB was executed by both algorithms RC5 and RC6. CPU utilization and Memory utilization for each algorithm was also captured. 250 Execution Time in ms For the accuracy point of view we executed that file 5 200 times and then taken the average of them. 150 120 100 100 50 80 0 60 16-Bytes 40 24-Bytes 32-Bytes 20 0 16-Bytes 24-Bytes 32-Bytes 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 RC5 (no of round : 12) 169.27 166.66 171.88 RC6 (no of round : 20) 216.15 213.54 213.54 Per 1000 block of encryption CPU utilization (avg : 79.92 %) Memory utilization (avg : 518.17 MB) Fig 10: Average Execution Time in millisecond Fig 8: CPU Utilization & Memory Utilization of RC5 In addition, if we consider on resource utilization then we Fig 8 shows the CPU utilization and Memory utilization got that RC6 utilize 2% extra CUP usage compared to for RC5 block cipher algorithm. Blue line represents the RC5 and memory utilization is approximately same for CPU usage in percentage (0-100 %) and Red line both algorithms. represents the Memory usage in 10MB (40 means 400MB). Average CPU utilization is 79.92 % and average V. CONCLUSION Memory utilization is 518.17 MB for RC5. In this research paper RC5 and RC6 block cipher algorithms were compared by using C# program in visual 120 studio 2009. Performance of both algorithms were 100 measured on a 3GHz Pentium®4 with 1GB of RAM 80 running Windows XP professional Version 2002, Service 60 pack 3. Comparative analysis of RC5 and RC6 have been 40 done with a set of input files and evaluated the encryption 20 & decryption time. Results conclude that RC5 is 1.27 0 times faster for 16-bytes key, 1.28 times faster for 24- 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 bytes key, 1.24 times faster for 32-bytes key than RC6. Per 500 block of encryption Result also concludes that both algorithms perform fastest CPU utilization (avg : 81.90 %) for 24-bytes key. Memory utilization (avg : 517.82 MB) RC6 utilize 2% extra CPU usage while memory Fig 9: CPU Utilization & Memory Utilization of RC6 utilization is approximately same for both algorithms. So RC5 block cipher algorithm is a fast and better block Fig 9 shows the CPU utilization and Memory utilization cipher algorithm for small application where security not for RC6 algorithm. Blue line represents the CPU usage in play very crucial role. percentage (0-100 %) and Red line represents the Memory usage in 10MB (40 means 400MB). Average REFERENCES CPU utilization is 81.90 % and average Memory [1] W. Stallings, "Cryptography and Network Security: Principles and utilization is 517.82 MB for RC6. Practice", Prentice-Hall, New Jersey, 1999. [2] Ronald L. Rivest, “RC5 Encryption Algorithm”, Dr Dobbs Journal, C. Result Analysis Vol. 226, PP. 146-148, Jan 1995. RC5 performs faster than RC6. Fig 10 shows the average [3] Ronald L. Rivest, The RC5 Encryption Algorithm, MIT execution time for both algorithms to execute the files Laboratory for Computer Science 545 Technology Square, Cambridge, Mass.02139 (Revised March 20, 1997). Available at: mentioned in table 3, 4 and 5. According to fig 10 RC5 is httu://theory.lcs.mit.cdu/-rivest/Rivest-rc5rev.pdf 1.27 times faster than RC6 for 16-bytes key, 1.28 times faster than RC6 for 24-bytes key, 1.24 times faster than March Issue Page 13 of 68 ISSN 2229 5208 International Journal of Computer Information Systems, Vol. 4, No. 3, 2012 [4] Ronald L. Rivest, M.J.B. Robshaw, R. Sidney, and Y.L.Yin, The AUTHORS PROFILE RC6 TM Block Cipher , M.I.T. Laboratory for Computer Science, 545 Technology Square, Cambridge, MA 02139, Version 1.1 - Ravindra Kumar Singh received B.Tech August 20, 1998. Available at: degree in Information Technology in 2009 from http://people.csail.mit.edu/rivest/Rc6.pdf Ajay Kumar Garg Engineering College Ghaziabad affiliated to Utter Pradesh Technical [5] “RC6® Block Cipher”, “rsa.com”. Available at: University, India. Currently he is pursuing http://www.rsa.com/rsalabs/node.asp?id=2512 M.Tech, in Computer Science and Engineering [6] “RC5” “wikipedia.org”. Available at: from National Institute of Technology http://en.wikipedia.org/wiki/RC5 Jalandhar India in 2009 and 2011 respectively. His research interests include in cryptography and network security. [7] “RC6”, “wikipedia.org”. Available at: http://en.wikipedia.org/wiki/RC6 Dr. Harsh Kumar Verma has completed PhD in [8] “Report on the Development of the Advanced Encryption Standard Computer Science and Engineering from Punjab (AES).", “csrc.net”. Available at: Technical University Punjab, India. Currently he http://csrc.nist.gov/encryption/aes/round2/r2report.pdf is Associate Professor and Head of Department [9] “New European Schemes for Signatures, Integrity, and Encrypt”. of Computer Science and Engineering in National Available at: https://cosic.esat.kuleuven.be/nessie Institute of Technology Jalandhar, India. His research interests include numerical [10] “Cryptography Research and Evaluation Committees”. Available computing, information security and computer at: http://www.cryptrec.go.jp/english/about.html networks. He has published various papers in national and international journals and conferences. He has attended various national and [11] “What are RC5 and RC6”,”rsa.com”. Available at: international workshops, training schools and other technical activities http://www.rsa.com/rsalabs/node.asp?id=2251 during his academic carrier. [12] Abdul Hamid M. Ragab, Nabil A. Ismail, Senior Member IEEE, and Osama S. Farag Allah, “Enhancements and Implementation of RC6TM Block Cipher for Data Security”, IEEE Catalogue No. 01 CH37239-0-7803-7101-1/01 © 2001 IEEE. March Issue Page 14 of 68 ISSN 2229 5208