CAST5 explained in plain terms means understanding a cipher that quietly guarded email for millions of people, a Canadian design that became the default encryption inside PGP and stayed there for decades. The central question is how a cipher almost nobody has heard of ended up protecting so much mail, and the answer is that it was fast, free, and good enough to trust.
CAST5 is a block cipher designed by Carlisle Adams and Stafford Tavares in Canada and published in 1996, originally known as CAST-128. It encrypts 64-bit blocks with a key of 40 to 128 bits, runs for 12 or 16 rounds depending on the key, and it became the default symmetric cipher in PGP, the program that made encrypted email practical for ordinary people.
This article gives you seven facts about CAST5, explains what it is, how it works, and where it already runs.
Key takeaways
- CAST5 is a block cipher designed in Canada in 1996.
- It encrypts 64-bit blocks with keys of 40 to 128 bits.
- It runs for 12 rounds with short keys and 16 with long ones.
- It was the default cipher in PGP for many years.
- It is standardised in RFC 2144 for use in IPsec and more.
What CAST5 is
CAST5 is a cipher that encrypts data in 64-bit blocks using a Feistel structure, splitting each block into two 32-bit halves and processing them in turns. In each round, one half is transformed by a function built from substitution boxes, addition, and rotation, mixed with part of the key, and combined with the other half, and the halves swap places for the next round.
Its signature feature is the set of four large substitution boxes at the heart of every round. The round function passes data through the S-boxes, combines the results with addition and subtraction, and rotates the outcome, which means a small change in the input spreads quickly through the whole block, and that diffusion is what makes the cipher hard to attack.
The design was a reaction to the needs of the early internet. In the mid-1990s, encrypted email needed a cipher that was fast in software, free of patents, and strong enough to trust, and Adams and Tavares built CAST5 to meet exactly those needs, publishing the design openly so that anyone could study it and use it without paying a licence fee.
It became the default cipher of PGP, the program that brought public-key cryptography to ordinary email users. When Phil Zimmermann’s PGP needed a symmetric cipher to encrypt messages, CAST5 was chosen for its speed and its open design, which means millions of encrypted emails were protected by a Canadian cipher that most of their senders had never heard of.
Its most famous property is the variable key size. CAST5 accepts keys from 40 bits up to 128 bits, and the number of rounds grows with the key, which means the same cipher could satisfy both the export rules of the 1990s, which limited key lengths, and the stronger security that users actually wanted, and that flexibility helped it spread.
Our guide to Blowfish explains another Feistel cipher from the same era, and our guide to Camellia explains a later cipher built for similar work.
How CAST5 works
Everything starts with the key schedule, which expands the master key into the subkeys each round needs. The key is stretched into sixteen pairs of masking and rotation keys, and the schedule mixes the key bits thoroughly so that related keys produce unrelated subkeys, which stops an attacker from learning anything useful by comparing encryptions under similar keys.
Each round transforms one half of the block with a function built from the four S-boxes. The half is combined with a masking key, split into bytes, and each byte passes through a different S-box, and the four S-box outputs are then combined with addition and subtraction before the result is rotated and XORed with the other half.
The S-boxes themselves are the heart of the design. Each one maps eight input bits to 32 output bits using fixed tables derived from bent functions, and because the tables are large and irregular, they give the round function the nonlinearity that every cipher needs, which is what stops an attacker from treating CAST5 as a linear system.
The round count depends on the key length, which is unusual among ciphers. With a key of 80 bits or less, CAST5 runs for 12 rounds, and with a longer key it runs for 16, which means the stronger keys get more mixing to match, and the designers chose those numbers after studying how many rounds the best attacks of the day could break.
Decryption runs the same rounds in reverse, starting with the final subkeys and working backwards through the rounds. The receiver applies the subkeys in the opposite order and inverts each round function, and the plaintext comes back out, which means the same small code can encrypt and decrypt without a second implementation.
The security of the design rests on the S-boxes and the round count. The best published attacks break only versions with far fewer rounds than the real cipher uses, and the full 16-round design has survived nearly thirty years of public analysis, which is why CAST5 is still trusted in the systems that use it.

Comparing CAST5 with other Feistel ciphers
CAST5 is one of several Feistel ciphers, and each was built with a different emphasis. Blowfish is the larger Feistel cipher with key-dependent substitution boxes, DES is the older standard with a 56-bit key and 16 rounds, and CAST5 is the flexible cipher with a variable key and a round count that grows with it, while each approach trades something for something else.
The table below sets out the main contrasts between the leading approaches.
| Aspect | CAST5 | Blowfish | DES |
|---|---|---|---|
| Block size | 64 bits | 64 bits | 64 bits |
| Key size | 40 to 128 bits | 32 to 448 bits | 56 bits |
| Rounds | 12 or 16 | 16 | 16 |
| Structure | Feistel | Feistel | Feistel |
| Best for | Email encryption | General software | Historical interest |
The practical result is that CAST5 is the right choice for email encryption, Blowfish suits general software, and DES fits historical interest only.
Where CAST5 is used
PGP and GnuPG use it to protect email. CAST5 was the default symmetric cipher in PGP for many years, and it remains available in GnuPG, the free implementation that carries on the PGP tradition, which means encrypted messages sent with those tools may still be protected by CAST5 today.
OpenPGP uses it as a standard algorithm. The OpenPGP standard lists CAST5 among its approved symmetric ciphers, and implementations that follow the standard must support it, which means the cipher is part of the toolkit that keeps encrypted email interoperable across different programs and platforms.
IPsec uses it to protect network traffic. CAST5 is standardised in RFC 2144 for use in IPsec, the protocol that secures internet traffic, which means virtual private networks and other IPsec systems can negotiate CAST5 for their encryption, and the standard gives it a clear basis in the internet’s own rules.
Software libraries support it for completeness. Cryptographic libraries that aim to support every cipher include CAST5, because developers working with OpenPGP need it, and because a library without it is incomplete for that audience, which keeps CAST5 in the toolkits that matter.
Teaching uses it to show how Feistel ciphers work. CAST5 is small enough to explain in a lecture and well documented enough to implement in an afternoon, which makes it a favourite example in cryptography courses that cover the ciphers of the 1990s and the design ideas that shaped them.
Strengths and limits
The greatest strength of CAST5 is its track record. A cipher that guarded email for millions of people and survived nearly thirty years of public analysis has earned its trust the hard way, and the absence of any practical attack against the full design is the best evidence a cipher can offer.
It is also a strength that the design is open and unencumbered. CAST5 was published freely with no patent restrictions, which meant anyone could implement it, study it, and use it without permission, and that openness is a large part of why it spread so quickly through the email world of the 1990s.
The limits are real, though, and the biggest is the 64-bit block. Short blocks mean that after enough data is encrypted with one key, patterns can start to leak, so CAST5 suits messages and files rather than bulk data, and a system that moves large volumes should choose a cipher with a 128-bit block instead.
CAST5 checklist
- Use CAST5 where OpenPGP compatibility is needed.
- Always use the full 128-bit key when you have the choice.
- Use a proper mode of operation, never raw block encryption.
- Use a fresh initialisation vector for every message.
- Remember CAST5 encrypts but does not authenticate on its own.
- Add a message authentication code if tampering is a concern.
- Test against published test vectors before shipping any implementation.
- Keep keys random and protect them as carefully as with any cipher.
- Compare with AES for systems that do not need PGP compatibility.
Frequently asked questions
What is CAST5 in simple terms?
It is a block cipher from Canada that encrypts 64-bit blocks with a key of up to 128 bits, using a Feistel design with four large substitution boxes, and it became the default cipher in PGP.
Why is it called CAST5?
CAST is named for its designers, Carlisle Adams and Stafford Tavares, and the 5 marks it as the 128-bit version of the CAST family, the one standardised for general use.
How is CAST5 different from Blowfish?
Both are Feistel ciphers from the same era, but CAST5 uses fixed substitution boxes with a variable key and round count, while Blowfish builds its substitution boxes from the key itself.
Is CAST5 still used?
Yes, it remains an approved OpenPGP cipher and is still supported in GnuPG, though new systems usually choose AES instead.
What is the 64-bit block limit?
With 64-bit blocks, encrypting very large amounts of data under one key can eventually leak patterns, so CAST5 suits messages and files rather than bulk traffic.
When should I use CAST5?
When you need OpenPGP compatibility, when you work with legacy encrypted mail, or when you want a cipher with a long public record.
The bottom line
CAST5 explained in one line is this: the quiet Canadian cipher that guarded the world’s email, a fast, free Feistel design that earned its place inside PGP and never left.
It is proof that a cipher does not need fame to matter, and the reason it still matters is that the mail it protected is still being read, and the standard it shaped is still in use.
This article is general information about how CAST5 works, not advice about choosing encryption for a particular device or system.







