Fact-checked by Grok 2 weeks ago

RC5

RC5 is a symmetric-key designed by Ronald L. Rivest of the 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 , while supporting modes such as ECB, , CFB, and OFB for practical applications. 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 Data Security until expiration, and it has been standardized in documents like RFC 2040 for interoperability in protocols. Although not selected for the 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 $2^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 w (in bits, typically 16, 32, or 64, yielding a size of $2w bits), the length b (in bytes, ranging from 0 to 255), and the number of rounds r (from 0 to 255). The original proposal recommended the configuration RC5-32/12/16, corresponding to a 64-bit , 128-bit , and 12 rounds. A key innovation in RC5 is its use of data-dependent rotations, which introduce non-linearity and enhance across the .

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 size, which is 2w bits; allowable values are 16, 32, or 64 bits, with 32 bits (yielding a standard 64-bit ) being the nominal choice for most implementations. Smaller w values enable faster execution on with limited word-processing capabilities, while larger w enhances by increasing the size and the complexity of arithmetic operations $2^w. The computations involve data-dependent rotations by amounts derived from word additions $2^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 (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 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 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 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 $2^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 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 w, rounds r, and key bytes b) 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 recommended for replacing 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 () 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 S of t = 2(r + 1) words, where each word is w bits wide and r is the number of rounds. The input is the secret key K, an of b bytes where $0 < b \leq 255, which is first converted into an L of c = \lceil b / u \rceil words, with u = 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 S. The first subkey is set to a magic constant P_w, defined as the odd integer closest to (e - 2) \times 2^w, where e \approx 2.718281828459\ldots is the base of the natural logarithm; for the nominal word size w = 32, P_{32} = 0xB7E15163 in hexadecimal. Subsequent subkeys are then computed iteratively: for i = 1 to t-1, S = S[i-1] + Q_w, where Q_w is another magic constant, the odd integer closest to (\phi - 1) \times 2^w and \phi = (1 + \sqrt{5})/2 \approx 1.618033988749\ldots is the golden ratio; for w = 32, Q_{32} = 0x9E3779B9. These constants are chosen to promote good diffusion properties during the mixing phase that follows. The key mixing step then combines the initialized S with the key words in L through a that runs for $3 \times \max(t, c) iterations to ensure even diffusion regardless of the relative sizes of the arrays. Initialize variables A = 0, B = 0, i = 0, and j = 0. For each :
A ← ((S[i] + A + B) ≪ 3) mod 2^w
S[i] ← A
i ← (i + 1) mod t

B ← ((L[j] + A + B) ≪ (A + B mod 2^w)) mod 2^w
L[j] ← B
j ← (j + 1) mod c
Here, \ll denotes left , and all operations are performed modulo $2^w to keep values within word size. The rotation amounts in the mixing—fixed by 3 for S and variable as A + B for L—help avalanche the changes across the subkeys and key words. Once complete, the array S[0 \dots t-1] provides the subkeys used in the process, with even indices typically for additions and odd for XORs in rounds.

Encryption

The RC5 encryption algorithm operates on a 2w-bit block, divided into two w-bit words denoted as A and B, where w is the word size (typically 16, 32, or bits). The process utilizes a set of 2(r+1) subkeys derived from the secret key, stored in an array S[0..2r+1], with r being the number of rounds (typically 12 or more). All arithmetic additions are performed $2^w, and left rotations are by an amount taken w to ensure the shift value stays within the word size. Encryption begins with an initialization step to incorporate the initial subkeys:
A \leftarrow A + S{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}} \pmod{2^w}
B \leftarrow B + S{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}} \pmod{2^w}
This primes the data for mixing with the key material.
The core of the encryption consists of r iterative rounds, each applying a simple yet effective transformation that leverages data-dependent operations for and . In round i (for i = 1 to r):
First, update A using an exclusive-or (XOR) of A and B, followed by a left by the value of B ( w), and then addition of the corresponding subkey:
A \leftarrow ((A \oplus B) \ll B) + S[2i] \pmod{2^w}
Then, symmetrically update B using the new A:
B \leftarrow ((B \oplus A) \ll A) + S[2i+1] \pmod{2^w}
The data-dependent —where the shift amount is derived directly from the data itself—promotes a strong , ensuring that small changes in the input propagate rapidly through subsequent rounds, enhancing resistance to differential analysis.
Following the r rounds, the final values of A and B form the 2w-bit block, with no additional transformations applied. The complete is as follows:
A ← A + S[0]  (mod 2^w)
B ← B + S[1]  (mod 2^w)
for i = 1 to r do
    A ← ((A ⊕ B) <<< B) + S[2i]  (mod 2^w)
    B ← ((B ⊕ A) <<< A) + S[2i+1]  (mod 2^w)
output A || B  (as [ciphertext](/page/Ciphertext))
Here, ⊕ denotes XOR, <<< denotes , and || denotes . This structure ensures the algorithm's simplicity while achieving high performance on both and software platforms.

Decryption

The decryption process for RC5 inverts the encryption operations to recover the from the , using the same expanded and parameters as . It takes as input the 2w-bit , split into two w-bit words A and B, along with the subkey array S[0..2r+1] derived from the key expansion. Then, for each round i from r down to 1, the round function is inverted. Specifically, B is first updated as B ← ((B - S[2i+1]) right-rotate by A) XOR A, followed by A ← ((A - S[2i]) right-rotate by B) XOR B. These steps mirror the encryption rounds but apply the operations in reverse order, with the rotation amounts now derived from the updated values of the other word. Finally, the initial additions are undone: B ← B - S, followed by A ← A - S. The resulting words A and B form the w-bit blocks. For clarity, the core reverse round operations can be expressed as: \begin{align*} B_i &= \left( (B_{i+1} - S_{2i+1}) \ggg A_{i+1} \right) \oplus A_{i+1}, \\ A_i &= \left( (A_{i+1} - S_{2i}) \ggg B_i \right) \oplus B_i, \end{align*} where \ggg denotes right rotation by the specified number of bits (modulo w), and indices denote the state after each reverse round. The reversibility of RC5's decryption stems from the invertibility of its primitive operations: subtraction undoes addition modulo $2^w, a right rotation by a known amount (the value of the other word) inverts a left rotation, and XOR is its own inverse. This ensures that applying decryption to the output of encryption yields the original , establishing a for each parameter set (b, r, w).

Security Analysis

Known Attacks

RC5 was introduced in with claims of resistance to known cryptanalytic techniques, but subsequent analysis revealed vulnerabilities in reduced-round variants and specific parameter sets. Initial cryptanalytic efforts focused on and linear methods, with the first results published in 1995 by Kaliski and Yin, who described attacks requiring up to $2^{65} chosen plaintexts for 9-round RC5-32 and linear attacks needing $2^{47} known plaintexts for 5 rounds. These early attacks highlighted potential weaknesses in the data-dependent rotations and modular additions, though they were impractical for the nominal 12-round version. Differential cryptanalysis proved the most effective against full-round RC5 variants. In 1997, Knudsen and Meier refined the approach, identifying high-probability and demonstrating that RC5-32/12 has approximately $2^{28} weak keys susceptible to with $2^{44} plaintexts, a significant improvement over prior work. Building on this, Biryukov and Kushilevitz introduced a partial in 1998, enabling a practical on the full 12-round RC5-32/12/128 using only $2^{44} plaintexts and $2^{44} time, exploiting biases in the modular additions across multiple rounds. For higher rounds, differential attacks remain feasible only up to 14 rounds with increased complexity exceeding $2^{100}, rendering them impractical. Linear cryptanalysis also targets reduced-round RC5 effectively. The 1995 analysis by Kaliski and Yin outlined an attack on 5-round -32 requiring $2^{47} known plaintexts to recover subkeys, based on linear approximations of the rotation and XOR operations. later showed in 1998 that this attack overestimated the bias due to key-dependent effects, providing corrected linear hulls requiring approximately $2^{55} known plaintexts for 5-round -32, and $2^{78} for 6 rounds, with even higher costs for 7 or more rounds. These results underscore the cipher's vulnerability to linear approximations in early rounds but confirm that full 12+ rounds resist linear attacks under standard assumptions. The key schedule of RC5 exhibits weaknesses under related-key scenarios and for certain key classes. Knudsen and Meier noted in 1997 that the schedule's reliance on simple mixing allows related-key differentials to propagate through low-round variants (up to 4-5 rounds) with probability greater than $2^{-[32](/page/32)}, enabling key recovery with $2^{30} chosen plaintexts under related-key queries. Additionally, biases in the modular operation—such as non-uniform distribution small primes—can be exploited in the first few rounds to distinguish RC5 from random permutations using $2^{20} plaintexts, as explored in partitioning attacks analogous to mod n . Heys identified $2^{28} linearly weak keys for 12-round RC5-32/12/128, where linear approximations hold with bias $2^{-17}, allowing subkey recovery with $2^{17} known plaintexts. No practical attacks exist on RC5-32 with 14 or more rounds using standard 128-bit keys, as complexities exceed $2^{100} for both and linear methods; recommended parameters mitigate these by increasing rounds. However, the 64-bit size limits against generic attacks like birthday collisions to $2^{32} effort in multi-block modes, a concern amplified by modern computational capabilities. As of , no practical attacks on full-round RC5 with 14 or more rounds and standard keys have emerged beyond these classical methods. The original recommendations for RC5 parameters, as proposed by its designer , specified a word size w = 32 bits (yielding a 64-bit block), 12 rounds (r = 12), and a 128-bit key (b = 16 bytes). These choices aimed to balance and performance for software implementations on 32-bit processors. Subsequent revealed vulnerabilities in the original configuration, particularly to attacks on the 12-round with 64-bit blocks, which can be broken using approximately $2^{44} plaintexts. To mitigate known attacks, updated guidance recommends increasing the number of rounds to r = 18 to $20 for w = 32, providing a sufficient margin against current analytical techniques. For enhanced , a larger word size of w = 64 (128-bit block) is preferred, paired with at least 16 rounds as originally suggested for this variant. Key sizes should be at least 128 bits to resist brute-force attacks with current computational resources, with 256 bits recommended for long-term protection against advances in exhaustive search. Regarding block size, the 64-bit option (w = 32) should be avoided in new designs due to the risk of collisions after approximately $2^{32} blocks in common modes of operation, such as , which could enable practical attacks on large datasets. The 128-bit block (w = 64) offers adequate security for most applications under classical threats but lacks resistance to post-quantum attacks like on key search. Increasing r enhances security linearly with computational cost, as each round adds modular additions, XORs, and data-dependent rotations; this trade-off is particularly relevant for resource-constrained systems, where r = 12 to $16 may still be viable if paired with larger w. As of 2025, RC5 is not recommended for new cryptographic systems due to its age and the availability of more thoroughly vetted alternatives like or ChaCha20, which offer stronger guarantees against both classical and emerging threats. However, it remains viable for legacy applications when using boosted parameters such as w = 64, r \geq 16, and b \geq 16 bytes to maintain adequate protection.

Implementations and Usage

Software Implementations

The reference implementation of RC5, provided by Ronald Rivest in 1994, consists of non-optimized C code for the RC5-32/12/16 variant, which can be readily adapted to different platforms due to its use of basic arithmetic operations. RC5 is supported in several established cryptographic libraries, including OpenSSL (deprecated since version 3.0 and available only via the legacy provider), the C++ library Crypto++, and the Java library Bouncy Castle. In Python, RC5 can be implemented using third-party libraries such as custom modules, though it is not part of the standard cryptography package. RC5 performs efficiently in software owing to its reliance on simple operations like integer addition, XOR, and bit rotation, making it particularly well-suited for 32-bit processors. For instance, a 16-round implementation achieved approximately 25 clock cycles per byte on a 200 MHz processor in 1999 benchmarks. The algorithm's portability stems from its variable parameters for block size (32, 64, or 128 bits), (0 to 2040 bits), and number of rounds (0 to 255), enabling straightforward adaptation to 8-bit, 16-bit, 32-bit, or 64-bit environments without specialized hardware requirements. Although has been removed from modern standards such as TLS 1.3 due to concerns with reduced rounds, it persists in systems and is often employed for educational purposes or in non-critical applications.

Distributed.net Challenge

In 1997, distributed.net launched its efforts to demonstrate the strength of the through challenges, beginning with the successful cracking of a 56-bit key variant in just 250 days. The project, targeting a 72-bit key in the RC5-32/12/9 configuration, specifically commenced on December 3, 2002, following the completion of the 64-bit challenge. Sponsored initially by Laboratories, the project offered a US$10,000 prize for discovering the unknown secret key, to be distributed among the finder ($1,000), their team ($1,000), a participant-voted non-profit (6,000), and distributed.net ($2,000); however, discontinued the official challenges in May 2007, after which the effort continued under private sponsorship without altering the prize structure. The project employs a across the full 2^{72} keyspace, coordinated through volunteer-run client software available in languages including , , and , which download work units (key blocks) from "Bovine" servers and report results upon completion. To ensure accuracy, clients perform RC5 encryptions on a fixed plaintext-ciphertext pair for each candidate key, verifying matches against known values. As of November 18, 2025, participants have searched 14.925% of the keyspace, equivalent to over 705 quintillion keys tested, at a recent rate of approximately 3.7 trillion keys per second. At current rates, the project is projected to exhaust the keyspace in approximately 34 years (12,557 days at the recent rate), underscoring RC5's resistance to exhaustive attack even with global resources spanning over two decades. No solution has been found as of , and the ongoing effort serves as a for advancements in computational power and distributed systems, highlighting RC5's foundational role in early crowd-sourced cryptography demonstrations.

References

  1. [1]
    JAN95: The RC5 Encryption Algorithm - Jacob Filipp
    The RC5 encryption algorithm is a fast, symmetric block cipher suitable for hardware or software implementations. A novel feature of RC5 is the heavy use of ...Missing: original | Show results with:original
  2. [2]
    2040: The RC5, RC5-CBC, RC5-CBC-Pad, and RC5-CTS Algorithms
    The RC5 cipher was invented by Professor Ronald L. Rivest of the Massachusetts Institute of Technology in 1994. It is a very fast and simple algorithm that is ...
  3. [3]
    [PDF] rc5.pdf
    RC5 is a block-cipher with a two-word input (plaintext) block si z e and a two-word (ciphertext) output block si z e. The nominal choice for w is 32 bits ...Missing: original | Show results with:original
  4. [4]
    [PDF] The RC5 encryption algorithm - People | MIT CSAIL
    In this section we describe the RC5 algorithm, which consists of three compo- nents: a key expansion algorithm, an encryption algorithm, and a decryption.Missing: original | Show results with:original
  5. [5]
    [PDF] The RC5 Encryption Algorithm - People | MIT CSAIL
    The RC5 Encryption Algorithm. A fast, symmetric block cipher that may replace DES. Ronald L. Rivest. As technology improves, and as the true strength of RC5 ...Missing: original | Show results with:original
  6. [6]
    The RC5 encryption algorithm - SpringerLink
    Jun 2, 2005 · This document describes the RC5 encryption algorithm, a fast symmetric block cipher suitable for hardware or software implementations.Missing: original | Show results with:original
  7. [7]
    RFC 2040: The RC5, RC5-CBC, RC5-CBC-Pad, and RC5-CTS ... - hjp
    The RC5 cipher was invented by Professor Ronald L. Rivest of the Massachusetts Institute of Technology in 1994. It is a very fast and simple algorithm that is ...
  8. [8]
    Block encryption algorithm with data-dependent rotations
    1995-11-01. Application filed by RSA Data Security Inc. 1995-11-01. Priority to US08/548,318. 1998-03-03. Application granted. 1998-03-03. Publication of ...
  9. [9]
    Ronald L. Rivest : FAQ - People | MIT CSAIL
    May I use RC2, RC4, RC5, and/or RC6 freely in commercial products? A5. In general, you should contact RSA Security for a definitive answer to these questions.
  10. [10]
    On Differential and Linear Cryptanalysis of the RC5 Encryption ...
    This paper analyzes the security of the RC5 encryption algorithm against differential and linear cryptanalysis.
  11. [11]
    Differential cryptanalysis of RC5 - Knudsen - Wiley Online Library
    Sep 12, 2008 · In this paper we investigate the strength of the secret-key algorithm RC5 proposed by Ron Rivest. The target version of RC5 works on words ...
  12. [12]
    Improved cryptanalysis of RC5 - SpringerLink
    May 25, 2006 · RC5 is a fast block cipher designed by Ron Rivest in 1994. Since then several attempts of cryptanalysis of this cipher were published.
  13. [13]
    [PDF] New Results in Linear Cryptanalysis of RC5
    The basic idea of linear cryptanalysis is to find a linear relation, which is called an a.SKS roUTKV5W at%V o<= , among the plain- text, ciphertext and key bits ...
  14. [14]
    [PDF] The RC5 Encryption Algorithm? - People | MIT CSAIL
    Mar 20, 1997 · Abstract. This document describes the RC5 encryption algorithm, a fast symmetric block cipher suitable for hardware or software imple-.Missing: original | Show results with:original
  15. [15]
    Difference between RC2, RC4, RC5 and RC6
    Apr 1, 2019 · RC5 is a slightly newer block cipher and is secure with sufficient rounds. RC6 is an improvement upon RC5, increasing its security. It lost the ...
  16. [16]
    [PDF] Performance Comparison of the AES Submissions - CSRC
    Feb 1, 1999 · 43 clock cycles per byte, IDEA at 74 clock cycles per byte, 16-round RC5 at 25 clock cycles per byte, and. Blowfish at 20 clock cycles per ...
  17. [17]
    RFC 8446 - The Transport Layer Security (TLS) Protocol Version 1.3
    This document specifies version 1.3 of the Transport Layer Security (TLS) protocol. TLS allows client/server applications to communicate over the Internet.Missing: RC5 | Show results with:RC5
  18. [18]
    History & Timeline - distributed.net
    The project to find the Optimal Golomb Ruler with 27 marks begins, with an estimated completion time of 7 years.Missing: 2025 | Show results with:2025
  19. [19]
    Project RC5 - distributed.net
    Dec 3, 2013 · The "Bovine" RC5 effort was formed to take the responsibilities of coordinating and maintaining the RC5 servers that are needed to distribute key blocks.Missing: 2025 | Show results with:2025
  20. [20]
    Projects - distributed.net
    Mar 11, 2015 · Having successfully completed RC5-56 and RC5-64, we are now working on the 72-bit variant of this encryption algorithm! More information is ...Missing: 2025 | Show results with:2025
  21. [21]
    stats.distributed.net - RC5-72 Overall Project Stats
    ### RC5-72 Progress Summary (as of 2025-11-11, 23:59 UTC)