HAVAL explained in plain terms means understanding a hash function that lets you choose its own strength, a design from 1992 that offers five digest sizes and three round counts where most hashes offer one of each. The central question is why a hash would need so many settings, and the answer is that HAVAL was built for a world where nobody could agree on how strong a hash had to be, so its designers handed the choice to the user.
HAVAL is a cryptographic hash function designed by Yuliang Zheng, Josef Pieprzyk and Jennifer Seberry, and published in 1992. It turns a message of any length into a fixed-size fingerprint, and it is unusual because both the fingerprint length and the number of processing passes are settings the user picks, which means one algorithm can behave like five different hashes depending on how it is set up.
This article explains what HAVAL is, how it works, and where it still turns up today.
Key takeaways
- HAVAL is a hash function from 1992 with variable output size.
- It offers digests of 128, 160, 192, 224 or 256 bits.
- It runs in 3, 4 or 5 passes over each message block.
- It was designed by Zheng, Pieprzyk and Seberry.
- It is rarely used today after collisions were found in its 3-pass form.
What HAVAL is
HAVAL is a hash that turns a message into a short fingerprint, and that fingerprint is what lets software check whether a file or a message has changed. A user feeds in a document of any size, HAVAL processes it in blocks, and out comes a fixed-length digest, which means two different files should never produce the same digest, and that promise is the whole point of a hash function.
Its signature feature is the choice it hands you. Most hashes fix their output size at design time, but HAVAL lets the user pick a digest of 128, 160, 192, 224 or 256 bits, and separately pick whether the message is processed in 3, 4 or 5 passes, which means the same code can serve a quick checksum or a cautious fingerprint, and that flexibility was the design’s headline idea.
The design was a reaction to the hash debates of the early 1990s. MD4 had shown that hashes could be fast and simple, and MD5 was about to follow, but nobody knew how much security was enough, so the HAVAL team built a hash whose strength was a dial rather than a fixed value, because a dial lets the user decide how much work to spend on safety.
It became one of the best-known variable-output hashes in the world, and it is named in the textbooks that cover the hash designs of its era. HAVAL appears in cryptographic libraries such as Crypto++, it is taught in university courses on hash design, and it is cited whenever the question of variable-length digests comes up, which means the design outlived its practical use as an idea worth studying.
Its most famous property is the trade-off it makes visible. Every extra pass costs time and buys security, and every extra 32 bits of digest makes collisions harder to find, which means HAVAL shows the cost of safety in plain numbers, and that honesty is the reason it is still discussed even though almost nobody deploys it.
Our guide to MD4 explains the hash HAVAL was modelled on, and our guide to Tiger explains another 1990s hash built for speed.
How HAVAL works
Everything starts with padding, which stretches the message to a whole number of 1024-bit blocks. HAVAL appends a single 1 bit, then zeros, then the message length, which means every message ends up as a neat stack of blocks, and because the length is baked into the last block, two messages of different lengths can never be confused.
Each block begins with the chaining value, a set of eight 32-bit words that carries the running state from one block to the next. The block is mixed into that state word by word, which means the digest at the end is a summary of every block that came before, and because the state is only 256 bits, the design has to squeeze each block through a tight funnel.
The passes are what make the design work as a whole. Each pass runs a round function over the state several times, permuting the message words in a different order each time, which means the same block is stirred again and again, and because each pass uses a different order, the stirring never repeats itself in a way an attacker can predict.
The round function spreads the effect further. It takes one message word, adds it to a state word, rotates the result, and mixes it through a Boolean function chosen for the round, which means a single changed bit in the message fans out across the whole state, and because that spreading happens dozens of times per block, the final digest depends on every input bit.
The number of passes changes the cost and the safety together. Three passes run fastest and were once thought strong enough, four passes add a margin, and five passes are the cautious choice, which means the user picks the balance they want, and because each pass is a full sweep of the block, the cost grows in a straight line.
The digest comes from the final state, trimmed to the length the user asked for. After the last block, HAVAL takes the eight state words and outputs as many bits as requested, which means a 128-bit digest is just the first half of the same state that gives a 256-bit digest, and that shared core is what makes the variable output possible.

Comparing HAVAL with other 1990s hashes
HAVAL is one of several hashes designed in the early 1990s, and each was built with a different emphasis. MD4 is the fast ancestor that most of them learned from, MD5 is the careful revision that became the world’s default, and HAVAL is the one that lets the user pick the output size and the pass count, while each approach trades something for something else.
The table below sets out the main contrasts between the leading approaches.
| Aspect | HAVAL | MD4 | MD5 |
|---|---|---|---|
| Output size | 128 to 256 bits | 128 bits | 128 bits |
| Passes | 3, 4 or 5 | 3 | 4 |
| Block size | 1024 bits | 512 bits | 512 bits |
| Year | 1992 | 1990 | 1992 |
| Best for | Flexible digests | Speed | General use |
The practical result is that HAVAL is the right choice for flexible digests, MD4 suits raw speed, and MD5 fits general use instead.
Where HAVAL is used
Libraries use it as a legacy option. Crypto++ and a handful of other toolkits still ship HAVAL, because old code sometimes needs to verify old digests, which means the hash survives as a compatibility feature, and that quiet survival is the reason it is still maintained.
Teaching uses it to show the strength dial. Cryptography courses introduce HAVAL when they explain how digest size and round count trade against speed, because it is the clearest example of a hash whose security is a setting, and a student who understands HAVAL understands why modern hashes fixed those choices instead.
Research uses it as a collision case study. The 2004 attacks on 3-pass HAVAL-128 are cited whenever hash designers discuss how many rounds a design needs, which means the hash survives as a warning, and its failure is the reason later designs were given wider margins.
Standards history uses it to mark the variable-output era. HAVAL was part of the early-1990s wave that explored what a hash could be, and it represents the path of user-chosen parameters that standardisation explored, which means historians of the field return to it whenever they ask why later hashes took those choices away.
Software uses it for old file checks. A few older applications and file formats stored HAVAL digests, and tools that read those formats still need the algorithm, which means the hash lives on in the corners where old data is still checked, and that niche is the reason it has not vanished entirely.
Strengths and limits
The greatest strength of HAVAL is its flexibility. A hash that offers five digest sizes and three pass counts fits more jobs than a hash with one of each, and that range is real, measured in the settings users can actually pick and confirmed by the libraries that kept it as an option.
It is also a strength that the design is simple to follow. A hash built from additions, rotations and Boolean functions is easy to implement and easy to analyse, and that simplicity is worth more than cleverness in a field where hidden complexity usually means hidden flaws.
The limits are real, though, and the biggest is the collision found in its weakest form. Researchers broke 3-pass HAVAL-128 in 2004, and the 4-pass and 5-pass forms have never earned the trust that MD5 or SHA-1 once enjoyed, which means HAVAL must never be used for anything that needs real protection today, and its value is entirely as a lesson.
HAVAL checklist
- Use HAVAL only for legacy checks, never for new security.
- Remember it offers five digest sizes from 128 to 256 bits.
- Pick 5 passes if you must use it at all.
- Compare it with MD5 to see the variable-output trade-off.
- Note its 3-pass form was broken in 2004.
- Study its passes to understand round-count margins.
- Keep real secrets behind modern hashes, not HAVAL.
- Check library support before relying on it.
- Choose SHA-256 for any system that needs a standard today.
Frequently asked questions
What is HAVAL in simple terms?
It is a hash function from 1992 that turns any message into a fingerprint, and it lets the user choose both the fingerprint length and how many passes the message gets.
Who designed HAVAL?
Yuliang Zheng, Josef Pieprzyk and Jennifer Seberry, who published it in 1992 as a hash whose strength the user could tune.
How is HAVAL different from MD5?
Both are 1990s hashes built from additions and rotations, but HAVAL lets the user pick the digest size and pass count, while MD5 fixes both at 128 bits and four rounds.
Is HAVAL still secure?
No, collisions were found in 3-pass HAVAL-128 in 2004, and the design has never earned modern trust, so it should not protect anything that matters today.
Where is HAVAL used?
In a few cryptographic libraries as a legacy option, in university teaching, and in old file formats that stored its digests.
When should I use HAVAL?
When you study variable-output hash design, when you verify an old digest, or when you want a hash whose strength is a setting you can see.
The bottom line
HAVAL explained in one line is this: the hash with a dial on it, a 1992 design that let users choose their own digest size and pass count, and proved that choice itself is a design decision.
It is proof that flexibility has a price, and the reason it still matters is that every hash designed since has been judged partly by the lesson HAVAL taught.
This article is general information about how HAVAL works, not advice about choosing encryption for a particular device or system.







