CAST5
Carlisle Adams and Stafford Tavares's Feistel ciphers, once default in PGP
Old but not broken. Kept for interoperability; root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About CAST5
CAST5 is one of 2 CAST-128 and CAST-256 variants in the NextSSL registry, a block cipher. It uses a 5–16-byte key and an 8-byte (64-bit) block. Its registry entry cites RFC 2144 and CAST-128. It is also known as cast-128 and cast128. NextSSL lists it in the legacy tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
CAST-128 (also called CAST5) and CAST-256 (CAST6) are block ciphers designed using the CAST methodology of Carlisle Adams and Stafford Tavares. CAST5 was the default symmetric cipher in some versions of PGP and GnuPG.
CAST-128 is a 12- or 16-round Feistel network on a 64-bit block with keys from 40 to 128 bits. Its round functions mix modular addition, subtraction and XOR with key-dependent rotations and four large 8x32-bit S-boxes derived from bent functions. CAST-256 extends the design to a 128-bit block with keys up to 256 bits using a generalised Feistel structure of quad-rounds, and was an AES first-round candidate.
CAST-128 is specified in RFC 2144 and CAST-256 in RFC 2612. NextSSL includes both. CAST5 was used in OpenPGP, early SSH and some VPN products, and is still supported for decrypting old messages. CAST-256 was not selected as an AES finalist. Both were offered royalty-free by Entrust. It remains interoperable.
History
1996–1999CAST-128 published by Carlisle Adams and Stafford Tavares
Specified in RFC 2144
CAST-256 specified in RFC 2612
Security notes
No practical attacks on full CAST-128 or CAST-256 are known, but CAST-128's 64-bit block is vulnerable to birthday-bound attacks with large data volumes. Both are legacy choices.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 5 – 16 | Secret key |
| block | 8 | Block |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'legacy' is reachable from the root API only
block = root.call("blockcipher_encrypt", "cast5", None, key, plaintext_block)[0]
nextssl_root_blockcipher_encrypt("cast5", 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, "cast5", &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 CAST-128 and CAST-256 variants
1More block ciphers
All 84Frequently asked questions
What is CAST5?
CAST5 is a block cipher in the CAST-128 and CAST-256 family. CAST-128 (also called CAST5) and CAST-256 (CAST6) are block ciphers designed using the CAST methodology of Carlisle Adams and Stafford Tavares. It is also known as cast-128, cast128.
What are the CAST5 sizes?
In NextSSL, CAST5 uses: key 5 to 16 bytes, block 8 bytes.
Who designed CAST5 and when?
CAST5 belongs to the CAST-128 and CAST-256 family, first published in 1996 by Carlisle Adams, Stafford Tavares. Its origin: RFC 2144; RFC 2612.
Which standards define CAST5?
CAST5 is referenced by RFC 2144, CAST-128.
Is CAST5 safe to use?
CAST5 is in the legacy tier. Old but not broken. Kept for interoperability; root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other CAST-128 and CAST-256 variants are there?
NextSSL also registers cast6 in the CAST-128 and CAST-256 family.