Hubbry Logo
RC5RC5Main
Open search
RC5
Community hub
RC5
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something
RC5
RC5
from Wikipedia
RC5
One round (two half-rounds) of the RC5 block cipher
General
DesignersRon Rivest
First published1994
SuccessorsRC6, Akelarre
Cipher detail
Key sizes0 to 2040 bits (128 suggested)
Block sizes32, 64 or 128 bits (64 suggested)
StructureFeistel-like network
Rounds1-255 (12 suggested originally)
Best public cryptanalysis
12-round RC5 (with 64-bit blocks) is susceptible to a differential attack using 244 chosen plaintexts.[1]

In cryptography, RC5 is a symmetric-key block cipher notable for its simplicity. Designed by Ronald Rivest in 1994,[2] According to Ron Rivest, RC stands for "Ron's Code"[3] but its documentation gives only RC5 as its name[2]. The Advanced Encryption Standard (AES) candidate RC6 was based on RC5.

Description

[edit]

Unlike many schemes, RC5 has a variable block size (32, 64 or 128 bits), key size (0 to 2040 bits), and number of rounds (0 to 255). The original suggested choice of parameters were a block size of 64 bits, a 128-bit key, and 12 rounds.

A key feature of RC5 is the use of data-dependent rotations; one of the goals of RC5 was to prompt the study and evaluation of such operations as a cryptographic primitive.[citation needed] RC5 also consists of a number of modular additions and eXclusive OR (XOR)s. The general structure of the algorithm is a Feistel-like network, similar to RC2. The encryption and decryption routines can be specified in a few lines of code. The key schedule, however, is more complex, expanding the key using an essentially one-way function with the binary expansions of both e and the golden ratio as sources of "nothing up my sleeve numbers". The tantalising simplicity of the algorithm together with the novelty of the data-dependent rotations has made RC5 an attractive object of study for cryptanalysts.[according to whom?] RC5 is basically denoted as RC5-w/r/b where w=word size in bits, r=number of rounds, b=number of bytes in the key.

Algorithm

[edit]

RC5 encryption and decryption both expand the random key into 2(r+1) words that will be used sequentially (and only once each) during the encryption and decryption processes. All of the below comes from Rivest's revised paper on RC5.[4]

Key expansion

[edit]

The key expansion algorithm is illustrated below, first in pseudocode, then example C code copied directly from the reference paper's appendix.

Following the naming scheme of the paper, the following variable names are used:

  • w – The length of a word in bits, typically 16, 32 or 64. Encryption is done in 2-word blocks.
  • u = w/8 – The length of a word in bytes.
  • b – The length of the key in bytes.
  • K[] – The key, considered as an array of bytes (using 0-based indexing).
  • c – The length of the key in words (or 1, if b = 0).
  • L[] – A temporary working array used during key scheduling, initialized to the key in words.
  • r – The number of rounds to use when encrypting data.
  • t = 2(r+1) – the number of round subkeys required.
  • S[] – The round subkey words.
  • Pw – The first magic constant, defined as Odd((e − 2)  ×  2w), where Odd is the nearest odd integer to the given input, e is the base of the natural logarithm, and w is defined above. For common values of w, the associated values of Pw are given here in hexadecimal:
    • For w = 16: 0xB7E1
    • For w = 32: 0xB7E15163
    • For w = 64: 0xB7E151628AED2A6B
  • Qw – The second magic constant, defined as Odd((𝜙 − 1)  ×  2w), where Odd is the nearest odd integer to the given input, where 𝜙 is the golden ratio, and w is defined above. For common values of w, the associated values of Qw are given here in hexadecimal:
    • For w = 16: 0x9E37
    • For w = 32: 0x9E3779B9
    • For w = 64: 0x9E3779B97F4A7C15
# Break K into words
# u = w / 8
c = ceiling(max(b, 1) / u)
# L is initially a c-length list of 0-valued w-length words
for i = b-1 down to 0 do:
    L[i / u] = (L[i / u] <<< 8) + K[i]
     
# Initialize key-independent pseudorandom S array
# S is initially a t=2(r+1) length list of undefined w-length words
S[0] = P_w
for i = 1 to t-1 do:
    S[i] = S[i - 1] + Q_w
    
# The main key scheduling loop
i = j = 0
A = B = 0
do 3 * max(t, c) times:
    A = S[i] = (S[i] + A + B) <<< 3
    B = L[j] = (L[j] + A + B) <<< (A + B)
    i = (i + 1) % t
    j = (j + 1) % c

# return S

The example source code is provided from the appendix of Rivest's paper on RC5. The implementation is designed to work with w = 32, r = 12, and b = 16.

void RC5_SETUP(unsigned char *K)
{
   // w = 32, r = 12, b = 16
   // c = max(1, ceil(8 * b/w))
   // t = 2 * (r+1)
   WORD i, j, k, u = w/8, A, B, L[c];
   
   for (i = b-1, L[c-1] = 0; i != -1; i--)
      L[i/u] = (L[i/u] << 8) + K[i];
   
   for (S[0] = P, i = 1; i < t; i++)
      S[i] = S[i-1] + Q;
   
   for (A = B = i = j = k = 0; k < 3 * t; k++, i = (i+1) % t, j = (j+1) % c)
   {
      A = S[i] = ROTL(S[i] + (A + B), 3);
      B = L[j] = ROTL(L[j] + (A + B), (A + B));
   }
}

Encryption

[edit]

Encryption involved several rounds of a simple function, with 12 or 20 rounds seemingly recommended, depending on security needs and time considerations. Beyond the variables used above, the following variables are used in this algorithm:

  • A, B - The two words composing the block of plaintext to be encrypted.
A = A + S[0]
B = B + S[1]
for i = 1 to r do:
    A = ((A ^ B) <<< B) + S[2 * i]
    B = ((B ^ A) <<< A) + S[2 * i + 1]

# The ciphertext block consists of the two-word wide block composed of A and B, in that order.
return A, B

The example C code given by Rivest is this.

void RC5_ENCRYPT(WORD *pt, WORD *ct)
{
   WORD i, A = pt[0] + S[0], B = pt[1] + S[1];
   
   for (i = 1; i <= r; i++)
   {
      A = ROTL(A ^ B, B) + S[2*i];
      B = ROTL(B ^ A, A) + S[2*i + 1];
   }
   ct[0] = A; ct[1] = B;
}

Decryption

[edit]

Decryption is a fairly straightforward reversal of the encryption process. The below pseudocode shows the process.

for i = r down to 1 do:
    B = ((B - S[2 * i + 1]) >>> A) ^ A
    A = ((A - S[2 * i]) >>> B) ^ B
B = B - S[1]
A = A - S[0]

return A, B

The example C code given by Rivest is this.

void RC5_DECRYPT(WORD *ct, WORD *pt)
{
   WORD i, B=ct[1], A=ct[0];
   
   for (i = r; i > 0; i--)
   {
      B = ROTR(B - S[2*i + 1], A) ^ A;
      A = ROTR(A - S[2*i], B) ^ B;
   }
   
   pt[1] = B - S[1]; pt[0] = A - S[0];
}

Cryptanalysis

[edit]

Twelve-round RC5 (with 64-bit blocks) is susceptible to a differential attack using 244 chosen plaintexts.[1] 18–20 rounds are suggested as sufficient protection.

A number of these challenge problems have been tackled using distributed computing, organised by Distributed.net. Distributed.net has brute-forced RC5 messages encrypted with 56-bit and 64-bit keys and has been working on cracking a 72-bit key since November 3, 2002.[5] As of July 26, 2023, 10.409% of the keyspace has been searched and based on the rate recorded that day, it would take a little more than 59 years to complete 100% of the keyspace.[6] The task has inspired many new and novel developments in the field of cluster computing.[7]

RSA Security, which had a (now expired) patent on the algorithm,[8] offered a series of US$10,000 prizes for breaking ciphertexts encrypted with RC5, but these contests were discontinued as of May 2007.[5] As a result, distributed.net decided to fund the monetary prize. The individual who discovers the winning key will receive US$1,000, their team (if applicable) will receive US$1,000, and the Free Software Foundation will receive US$2,000.[9]

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
RC5 is a symmetric-key designed by Ronald L. Rivest of the Massachusetts Institute of Technology in 1994, notable for its simplicity, speed, and parameterization to balance security and performance across hardware and software implementations. The algorithm operates on blocks of data using a variable word size w (typically 16, 32, or 64 bits, resulting in block sizes of 32, 64, or 128 bits), a variable number of rounds r (from 0 to 255, with common values of 8 to 16), and a variable key length b (from 0 to 255 bytes, up to 2040 bits), denoted in the form RC5-w/r/b. Its core operations rely on three primitive arithmetic and logical functions—modular addition, XOR, and left rotation—combined with data-dependent rotations to enhance and in each round. The design of RC5 emphasizes adaptability, allowing users to select parameters based on required security levels and computational resources; for instance, RC5-32/12/16 provides strong protection suitable for replacing older ciphers like DES, while supporting modes such as ECB, CBC, CFB, and OFB for practical applications. Key expansion derives a subkey array S from the user key using fixed constants derived from the (φ), ensuring even distribution and resistance to weak keys. Encryption begins by XORing the plaintext block (split into two words A and B) with initial subkeys, followed by r iterations of rotation, addition, and XOR operations that progressively mix the data. RC5 was publicly released to encourage widespread analysis and adoption, with its patent held by RSA Data Security until expiration, and it has been standardized in documents like RFC 2040 for interoperability in protocols. Although not selected for the AES standard due to preferences for fixed-parameter ciphers, RC5 remains influential for its innovative use of rotations and parameter flexibility, influencing subsequent designs.

Introduction

Description

RC5 is a parameterized family of symmetric key block ciphers designed for efficient implementation in both hardware and software environments. Invented by Ronald Rivest of the , it emphasizes simplicity and adaptability to varying computational resources. The core structure of RC5 operates as an iterative Feistel-like network, processing plaintext blocks consisting of two w-bit words through a variable number of rounds. It relies on just three primitive operations: bitwise exclusive-or (XOR), addition modulo 2w2^w, and left rotation by a data-dependent amount. These operations enable a streamlined design that promotes both speed and security without complex substitutions or permutations. RC5's flexibility arises from its tunable parameters: the word size ww (in bits, typically 16, 32, or 64, yielding a block size of 2w2w bits), the key length bb (in bytes, ranging from 0 to 255), and the number of rounds rr (from 0 to 255). The original proposal recommended the configuration RC5-32/12/16, corresponding to a 64-bit block, 128-bit key, and 12 rounds. A key innovation in RC5 is its use of data-dependent rotations, which introduce non-linearity and enhance across the block.

Parameters

RC5 is a parameterized family of block ciphers, with a specific instance denoted as RC5-w/r/b, where w is the word size in bits, r is the number of rounds, and b is the in bytes. The word size w determines the length of the words on which operations are performed and thus the block size, which is 2w bits; allowable values are 16, 32, or 64 bits, with 32 bits (yielding a standard 64-bit block) being the nominal choice for most implementations. Smaller w values enable faster execution on hardware with limited word-processing capabilities, while larger w enhances by increasing the block size and the complexity of arithmetic operations 2w2^w. The computations involve data-dependent rotations by amounts derived from word additions 2w2^w, making larger w more computationally intensive due to wider bit rotations and modular additions. The b ranges from 0 to 255 bytes (providing key lengths of 0 to 2040 bits in multiples of 8 bits), offering flexibility for varying needs; a 128-bit key (b=16) is recommended for adequate against brute-force attacks. Longer keys increase resistance to exhaustive search but require more time in the key expansion phase, which mixes the key into subkeys using operations scaled to w-bit words. The number of rounds r ranges from 0 to 255, with 12 rounds originally proposed as a balance between security and efficiency; higher r strengthens the against cryptanalytic attacks at the cost of additional iterations of the core mixing operations. In the algorithm's notation, the (and ) block is treated as two w-bit words, A and B. The secret key consists of b bytes, which are loaded into an array of c = \lceil b / (w/8) \rceil w-bit words for key expansion. The key expansion produces a subkey array S of 2(r + 1) w-bit words, which are used in the encryption and decryption rounds.

History

Development

RC5 was invented by Ronald L. Rivest, a professor at the , in 1994 as a symmetric-key designed to address the limitations of older standards like the (DES), which had a fixed key size and was becoming vulnerable to emerging computational threats. Rivest first presented the algorithm at the CRYPTO '94 conference, held in , where it was published in the proceedings as part of Advances in Cryptology. The primary motivations for developing stemmed from the need for a that could adapt to rapidly evolving processor technologies in the , offering flexibility in key length, block size, and number of rounds to suit various requirements without sacrificing . Rivest aimed to create an algorithm that was simple and efficient, emphasizing minimal primitive operations—such as exclusive-or, addition modulo 2w2^w, and data-dependent rotations—to ensure it could be implemented quickly in both software and hardware environments, including on resource-constrained devices like smart cards. This design philosophy was influenced by the simplicity of Rivest's earlier , but adapted for block encryption to provide a versatile alternative to DES amid growing demands for standardized, high-speed . The initial publication appeared in Rivest's 1994 paper, "The RC5 Encryption Algorithm," which outlined the cipher's parameterized structure (with word size ww, rounds rr, and key bytes bb) tuned for contemporary hardware like 32-bit microprocessors, positioning for general-purpose adoption in software applications and embedded systems. Early considerations focused on balancing and speed, with parameters such as RC5-32/12/16 recommended for replacing DES in typical 1990s computing scenarios.

Patent and Licensing

The RC5 block cipher is covered by U.S. Patent No. 5,724,428, titled "Block encryption algorithm with data-dependent rotations," invented by Ronald L. Rivest and assigned to RSA Data Security Inc. (later RSA Security). The patent application was filed on November 1, 1995, and granted on March 3, 1998, encompassing the core RC5 algorithm and its variants that employ data-dependent word rotations for encryption. RSA Security managed licensing for RC5 during the patent's term; commercial implementations typically required paid licenses, while non-commercial, academic, and research uses were permitted without fees. This licensing model allowed broad experimentation in open-source and educational contexts but imposed financial barriers on proprietary software and hardware products. The patent term, governed by U.S. law for applications filed after June 8, 1995, extended 20 years from the filing date, resulting in expiration on November 1, 2015. Following expiration, RC5 entered the , eliminating all licensing restrictions and enabling unrestricted global implementation in any context. The patent's enforcement during its active period limited RC5's commercial adoption in the late and early , as organizations favored unencumbered alternatives to avoid royalty fees, contributing to the preference for patent-free ciphers like the (AES) in standards and products. Post-expiration, while RC5 remains viable for niche applications, its historical licensing constraints have sustained lower prevalence compared to royalty-free successors.

Algorithm

Key Expansion

The key expansion in RC5 derives a set of subkeys from the user-provided secret key, producing an array SS of t=2(r+1)t = 2(r + 1) words, where each word is ww bits wide and rr is the number of rounds. The input is the secret key KK, an array of bb bytes where 0<b2550 < b \leq 255, which is first converted into an array LL of c=b/uc = \lceil b / u \rceil words, with u=w/8u = w / 8 bytes per word; if necessary, the key is zero-padded to fill the last word. This expansion ensures that the subkeys are thoroughly mixed and diffused, independent of any structure in the original key, to support the cipher's security. The process begins with initializing the subkey array SS. The first subkey is set to a magic constant PwP_w, defined as the odd integer closest to (e2)×2w(e - 2) \times 2^w, where e2.718281828459e \approx 2.718281828459\ldots is the base of the natural logarithm; for the nominal word size w=32w = 32, P32=0xB7E15163P_{32} = 0xB7E15163 in hexadecimal. Subsequent subkeys are then computed iteratively: for i=1i = 1 to t1t-1, S=S[i1]+QwS = S[i-1] + Q_w, where QwQ_w is another magic constant, the odd integer closest to (ϕ1)×2w(\phi - 1) \times 2^w and ϕ=(1+5)/21.618033988749\phi = (1 + \sqrt{5})/2 \approx 1.618033988749\ldots
Add your contribution
Related Hubs
Contribute something
User Avatar
No comments yet.