RC2
Ron Rivest's family of block ciphers, from the 1987 RC2 to the AES finalist RC6
Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About RC2
RC2 is one of 3 RC2, RC5 and RC6 variants in the NextSSL registry, a block cipher. It uses a 1–128-byte key and an 8-byte (64-bit) block. It takes the parameter effective_bits (default 0). Its registry entry cites RFC 2268. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
RC2, RC5 and RC6 are block ciphers designed by Ron Rivest for RSA Security. RC2 dates from 1987 and was used in early export-grade software; RC5 (1994) introduced data-dependent rotations; RC6 (1998) was one of the five AES finalists.
RC2 is a 64-bit block cipher built from 16 mixing and 2 mashing rounds on 16-bit words, with a variable-length key and an 'effective key bits' parameter (RFC 2268). RC5 is a Feistel-like ARX cipher parameterised by word size, rounds and key length, whose central operation is a rotation by an amount taken from the data. RC6 extends RC5 to four 32-bit registers with a 128-bit block and adds integer multiplication to speed diffusion.
NextSSL includes RC2, RC5 and RC6. RC2 appears in old S/MIME and PKCS #12 files, which is the main reason to support it. RC5 and RC6 were patented by RSA Security, which limited their adoption. The three ciphers share a name but not a structure, and their test vectors are not related. RC6 remains an interesting reference design for data-dependent rotations combined with multiplication.
History
1987–2001RC2 designed by Ron Rivest
RC5 published
Specified in RFC 2040
NIST calls for a successor to DES
AES selection processRC2 published as RFC 2268; RC6 submitted to the AES process
Five finalists: MARS, RC6, Rijndael, Serpent and Twofish
AES selection processRijndael selected
AES selection processAES published as FIPS 197
AES selection process
Security notes
RC2 is broken: it has related-key attacks and was routinely used with 40-bit export keys. RC5 with 12 rounds on 64-bit blocks has been attacked with differential cryptanalysis using large numbers of chosen plaintexts; more rounds are needed. RC6 has no known practical attack on its full 20 rounds but sees little use.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 1 – 128 | Secret key |
| block | 8 | Block |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| effective_bits | u64 | 0 – 1024 | 0 | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'broken' is reachable from the root API only
block = root.call("blockcipher_encrypt", "rc2", None, key, plaintext_block)[0]
nextssl_root_blockcipher_encrypt("rc2", NULL, key, block, out); /* exactly one block */
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_blockcipher_in(reg::all(), Policy::Any, "rc2", &Params::new())?;
let out = alg.encrypt_block(&key, &block)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other RC2, RC5 and RC6 variants
2Similar names
Looking for something else?More block ciphers
All 84Frequently asked questions
What is RC2?
RC2 is a block cipher in the RC2, RC5 and RC6 family. RC2, RC5 and RC6 are block ciphers designed by Ron Rivest for RSA Security.
What are the RC2 sizes?
In NextSSL, RC2 uses: key 1 to 128 bytes, block 8 bytes.
Who designed RC2 and when?
RC2 belongs to the RC2, RC5 and RC6 family, first published in 1998 by Ron Rivest. Its origin: RFC 2268 (RC2); RFC 2040 (RC5); AES finalist (RC6).
Which standards define RC2?
RC2 is referenced by RFC 2268.
Is RC2 safe to use?
RC2 is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other RC2, RC5 and RC6 variants are there?
NextSSL also registers rc5, rc6 in the RC2, RC5 and RC6 family.